Combo box problems

lycialive

Registered User.
Local time
Today, 08:18
Joined
Aug 24, 2009
Messages
27
Hi, I'm having problems getting my combo boxes to work.

I add records, but when I type in the name of a record and hit enter, I keep getting this error message:

"the microsoft access database engine does not recognize 'ID' as a valid field name or expression"

It then offers the end or debug option.

In the visual basic, this is what has worked for other forms, but won't work for this one:

' Find the record that matches the control.
Dim rs As Object

Set rs = Me.Recordset.Clone
rs.FindFirst "[ID] = " & Str(Me![Combo28])
Me.Bookmark = rs.Bookmark

any ideas? Thanks!
 
Is the field, in fact, named ID?

I'm also a little confused as to what you're trying to do here:

rs.FindFirst "[ID] = " & Str(Me![Combo28])

If ID is defined as a Text Datatype the syntax would be

rs.FindFirst "[ID] = '" & Me![Combo28] & "'"

if defined as a Number Datatype

rs.FindFirst "[ID] = " & Me![Combo28]
 
Hi, thanks for your reply.

I'm managing a number of service quotes and advertising. I have about 50 accounts, and in order to find them quickly, I just type into the combo box the beginning of the account-the rest fills in automatically, and hit enter to pull up the account. (unless of course, there's a better way to search for records other than using a combo box?)

So, in this instance, when I type it in and hit enter, I get the "end" or "debug" error screen.

When I built the combo box, I chose only 1 field, which was "jobs", then hit the > arrow key to move it into the work area. So, what I'm thinking is that the combo box should only be looking for the "jobs" info, and not the ID.

I'm just a beginner, and there's a lot I'm missing I know. I hope any of this makes sense. I've built 4 forms, the first one worked fine, the second one had problems, and the rest all have this error with the combo box.
 
Check the query of the combo box (the record source) it should bring up the QBE window on that control.

If you only have one field in there "Jobs" then you should probably have the "ID" as another field.

so it would be like:
JobID Job
1 Job1
2 Job2

Then you can hide the jobID but have it bound to the form, and all you will see is the Job name. Make sense?

Under the properties of the combo box:
Column count 2
column Width 0";2"
Bound column 1

This will bind your column and "should" stop the error message.

Larry
 
Last edited:
Thanks, but all of those things are already set. I'm still getting the error.
 

Users who are viewing this thread

Back
Top Bottom