View Single Post
  #8  
Old May 14th, 2010, 02:34 PM posted to microsoft.public.access.forms
KAquestions
external usenet poster
 
Posts: 20
Default Combo box finding wrong record

I have done it again and got it working, I must have had a typo

I really appreciate all your help, thanks,

Kirst

"KAquestions" (no_spam) wrote in message
...
Have tried both!

Now i have no error messages, but no matter what i pick the same record
comes up - the first one in the query?

Kirst

"BruceM via AccessMonster.com" u54429@uwe wrote in message
news:a7fdd05e5dc44@uwe...
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