Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Run-time error 3075 with where condition

Status
Not open for further replies.

Tadynn

Technical User
Oct 8, 2001
72
AU
I'm getting the following run-time error with my form.
Run-time error '3075'
Syntax error (missing operators) in query expression 'Exceed Order No = 1000008270'.

Basically I've created two forms, one form contains a list called "results". When the user doubleclicks on a line in the list, it's suppose to open up another form and only only show the record that the user has selected. Below is my VB code and other relevant properties pertaining to it.

Here is the code:


Private Sub Results_DblClick(Cancel As Integer)

DoCmd.OpenForm FormName:="TimeSlot_frm", _
WhereCondition:="Exceed Order No = " & Me.Results


End Sub



Here are the form properties:

Form with the list:

Form Name = Lookup Orders
List Name = Results
Field used for link = POKey (1st field in list)
No of fields in list = 8


The linked form properties:

Field used for the link = Exceed Order No
Field type = textbox


Obviously, even though they're name differently, the POKey and the Exceed Order No are the same field.

One thing that I thought is that I would have to declare in the statement, what position the POKey field was in the list. Is this correct? or am I way off the mark.


Thanks, Tadynn.
 
never seen that syntax before.
have you tried:

Private Sub Results_DblClick(Cancel As Integer)
dim strWhere
strWhere ="Exceed Order No = " & Me.Results
DoCmd.OpenForm "TimeSlot_frm",,strWhere
End Sub

?

 
Hi GingerR

I tried that code you wrote. It opens up the form okay, but still doesn't filter it properly.
 
I think you need to bracket the field name, as it contains blanks, e.g.:


DoCmd.OpenForm FormName:="TimeSlot_frm", _
WhereCondition:="[Exceed Order No] = " & Me.Results

To whom it may concern:

FormName:= ...
and
WhereCondition:= ...

are ways of explicitly specifying function arguments.
 
Hi beetee

I tried bracketing the Exceed Order No field just as you suggested. However I now get the following error message:

Run-time error '2501'
The OpenForm action was canceled.

and the form doesn't open at all.
 
If Exceed Order No is a text field you may need to use the single quote character:

WhereCondition:="[Exceed Order No] = '" & Me!Results & "'"

Ken
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top