View Single Post
  #6  
Old May 14th, 2010, 01:41 PM posted to microsoft.public.access.forms
BruceM via AccessMonster.com
external usenet poster
 
Posts: 448
Default Combo box finding wrong record

Quote marks are different for a text field. If ClientID is text you need to
use:

rs.FindFirst "[ClientID] = ' " & Me.cboClient & " ' "

This assumes the bound column of cboClient is ClientID.

If ClientID (or any text field) is in an expression such as the above, and
records may contain an apostrophe (e.g. Joe's Garage) you need a different
approach to the quotes:

rs.FindFirst "[ClientID] = " " " & Me.cboClient & " " " "

I added spaces between the quotes for clarity. If you add spaces the VBA
editor will get rid of them.


KAquestions wrote:
Hi Bruce,

Thanks very much for your response. I have done all that, but keep getting
the following error message

"Run Time Error 3464 : Data type mismatch in criteria expression"

I don't know where i should be looking to fix this. [ClientID] is a PK
field, which is Text - it's basically an ID number, but NOT autogenerated.
Will this be something to do with it?

Also, when i click debug, the line highlighted is:

rs.FindFirst "[ClientID] = " & Me.cboClient

Any further help would be much appreciated,

Kirst

I'm guessing you have After Update combo box code along the lines of:

[quoted text clipped - 68 lines]

Kirst


--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/For...forms/201005/1