Error in Form Code

Old Gnome

Registered User.
Local time
Today, 06:16
Joined
Jul 17, 2001
Messages
31
The following form code runs just fine in a colleague's database, but gives an error (Runtime error '3077' Syntax error (missing operator) in expression) in the application I am trying to build.

Can anyone help identify the source of the problem?

The line of code highlighted by the error is preceded by ***.

Sub Combo15_AfterUpdate()
' Find the record that matches the control.
*** Me.RecordsetClone.FindFirst "[ID] = " & Me![Combo15]
Me.Bookmark = Me.RecordsetClone.Bookmark
End Sub

Many thanks in advance.

oldgnome

[This message has been edited by Old Gnome (edited 10-12-2001).]
 
This is a very common error in coding. I fell victim to it many times myself before getting it right.

The line with the error should read:
Me.RecordsetClone.FindFirst "[ID] = '" & Me![Combo15] & "'"

Please note there are single and double quotes in the string.

Shep
 
Shep:

Thanks for the assist. As soon as I saw your answer, I realized the single- and double-quotes were missing.

I replaced the code and now I get the error:
Run Time error '3464' Data type mismatch in criteria expression. The same line is referenced [Progress, but not as far as I had hoped to get
smile.gif
.]

The two tables are linked one to many via the ID field (the same name in both). In one table (on the 'one' side), ID is an AutoNumber field, in the other (the 'many' side) a Number field as Long Integer, auto decimal places, default value 0, not required and indexed with duplicates OK.

(The form is supposed to serve as a facility for selecting projects whose detail show up in the subform. By typing in a new project name, you are taken to another form for entering the three pieces of information required as the project 'header.' You are then supposed to return to the form/subform to enter values in the subform.)

Am I wrong in trying to link the two databases together the way I have? Do I need to create another field in the first table that is a long integer (etc.), but plugged with the AutoNumber value?

TIA

oldgnome
 
Oops!
In the case of a number, the syntax will be:
Me.RecordsetClone.FindFirst "[ID] = " & Me![Combo15]
 
Oof.

So the original code should work?

I am going to try it on Access 2000 soon and see if that doesn't pry the error loose.

Anything else you can think of?

oldgnome
 
Yes, it should.
You have an unexplained one there. I have experienced some anomolies that simply 'couldn't be' in Access, mainly when I try to use components from other modules or databases...looks like you've got one.
 

Users who are viewing this thread

Back
Top Bottom