Where Condition

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi I have a Book Collection Database. I have three tables called Book
Collection, Book Reviews, and Leveled books. I have these three tables in
different forms. I click back and forth into these forms using a command
button. When I am in my Book Collection Form, I would like to click on the
Book Reviews command button and the right Id number comes up. For example, I
have id X which relates to the book called "The Fence". I want to click on
the Book Reviews button, and Automatically X comes up, instead of going to
the beginning. I used the following expression in the Where Condition, but
it is not working correctly. When I use it, it comes up with no data. Plase
help.

[ID]=[Forms]![Book Reviews]![ID]

Stephen
 
Stephen,

Each form exposes a Recordset property.
You can perform functions on these recordsets.

Example:
Form: MyForm1:
Private sub Command1_Click()

if len(nz(me.MyID.Value, "") > 0 then ' iof MyID has a valid value...
forms("MyForm2").form.recordset.findfirst "[ID] = " & cstr(me.MyID.value)
'or, if MyID is a string:
forms("MyForm2").form.recordset.findfirst "[ID] = '" &
replace$(me.myID.Value, "'", "''") & "'"
forms("MyForm2").form.setfocus
endif

End Sub
 
Back
Top