Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Forms Programming / May 2007

Tip: Looking for answers? Try searching our database.

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

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
John D - 03 May 2007 02:33 GMT
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
Carl Rapson - 03 May 2007 15:47 GMT
>I have a form [FA1_OrgMaster] that has a Combo Box [cboCounties].
>
[quoted text clipped - 52 lines]
>
> 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
John D - 03 May 2007 17:19 GMT
: \   DUHH  

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

Thanks Carl - John D
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.