The reason for the quotes and ampersands is that the reference to the
control has to be outside of the quotes so that you get its value. The
FindFirst method is unable to resolve the field reference on its own.
For the error you're getting, make sure that the name of the control on
Queries form that holds the subform is named branch form. Depending on how
you added branch form as a subform to Queries form, the name of the control
may not be the same as the name of the form being used as a subform: it's
the name of the control you want in that statement.
--
Doug Steele, Microsoft Access MVP
(no private e-mails, please)
scubadiver said:
I assume there is a reason for the double quotes and ampersands around the
reference? Is it because the reference is in a subform?
[Forms]![Queries form]![branch form].Form![Address1]
I still have the above and the message is now: "Can't find the field
'branch
form' referred to in your expression". I still can't see what is going on!
:
I thought it was correct
I don't know whether you gathered the code is in VBA.
This is the code in its entirety as I have it now:
Dim rstClone As Object
Set rstClone = Me.RecordsetClone
rstClone.FindFirst "[CustomerName] = '" & Me.Customer & "' And
[forms]![queries form]![Branch form].[form]![address1] = '" &
Me.address & "'"
Me.Bookmark = rstClone.Bookmark
Set rstClone = Nothing
End Sub
Get the following message:
"The microsoft jet database engine does not recognise ....[ ]....as a
valid
field name or expression".
You should have the form reference outside the quotes...
rstClone.FindFirst "[CustomerName] = '" & Me.Customer & "' And " &
[forms]![queries form]![Branch form].[form]![address1] & " = '" &
Me.address &
"'"