Wrong Data Type - Too Many Characters - But That's Not True

G

Guest

I have a form [FA1_OrgMaster] that has a Combo Box [cboCounties].

The cbo's Row Source is a Query with 2 columns - [TYaa_CountyNumber] -
Integer, and [TYaa_CountyName] - Text 50 characters. The first column -
CountyNumber - is Bound, but only the 2nd is displayed to the user in the cbo.

I have a Form Open Event Procedure - but it doesn't affect the cbo.

I have a Form Load Procedure that does:
_______________
Private Sub Form_Load()

On Error GoTo HandleError

Me!cboOrgs = Null
Me!cboCounties = Null
Me!cboCounties = "Choose County"
Me!cboCounties.SetFocus

Exit Sub

HandleError:
...
Exit Sub

End Sub
_______________________

I've clicked the cbo, oh maybe 1000 times. Works perfectly about 95% of the
time - but I get an error message without an error number about 5% of the
time - "Wrong Data Type or Too Many Characters ...".

I can't see a pattern leading to the error. I've gotten the error when:
* click the cbo immediately I open the Form from the Database Window
* go from Design back to Form View and immediately click the cbo
* click the cbo after I've been jumping all around the form, entering data,
etc

But most of the time I do those things I don't get the error. I've never
been able to replicate the error by repeating what I think I did.

When I get the error message and click OK, sometimes the Cbo "drops down"
immediately. Other times I have to click the down arrow on the cbo. So - even
with the error message, the program proceeds normally without my having made
any changes other than click "OK" on the error message.

I'm stumped. Any ideas?

Thanks

John D
 
C

Carl Rapson

John D said:
I have a form [FA1_OrgMaster] that has a Combo Box [cboCounties].

The cbo's Row Source is a Query with 2 columns - [TYaa_CountyNumber] -
Integer, and [TYaa_CountyName] - Text 50 characters. The first column -
CountyNumber - is Bound, but only the 2nd is displayed to the user in the
cbo.

I have a Form Open Event Procedure - but it doesn't affect the cbo.

I have a Form Load Procedure that does:
_______________
Private Sub Form_Load()

On Error GoTo HandleError

Me!cboOrgs = Null
Me!cboCounties = Null
Me!cboCounties = "Choose County"
Me!cboCounties.SetFocus

Exit Sub

HandleError:
...
Exit Sub

End Sub
_______________________

I've clicked the cbo, oh maybe 1000 times. Works perfectly about 95% of
the
time - but I get an error message without an error number about 5% of the
time - "Wrong Data Type or Too Many Characters ...".

I can't see a pattern leading to the error. I've gotten the error when:
* click the cbo immediately I open the Form from the Database Window
* go from Design back to Form View and immediately click the cbo
* click the cbo after I've been jumping all around the form, entering
data,
etc

But most of the time I do those things I don't get the error. I've never
been able to replicate the error by repeating what I think I did.

When I get the error message and click OK, sometimes the Cbo "drops down"
immediately. Other times I have to click the down arrow on the cbo. So -
even
with the error message, the program proceeds normally without my having
made
any changes other than click "OK" on the error message.

I'm stumped. Any ideas?

Thanks

John D

The first problem I can see is that you've bound the combo box to a numeric
value (TYaa_CountyNumber) but in the Form_Load event you're setting it to a
string value ("Choose County"). Shouldn't you be setting the combo box to
the numeric value that corresponds to the string? That might be a place to
start looking.

Carl Rapson
 
G

Guest

: \ DUHH

Amazing what I sometimes don't see right under my nose!

Thanks Carl - John D
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top