Filtering Records Problem

  • Thread starter Thread starter Eddy
  • Start date Start date
E

Eddy

I use the following code to find then open a form to a specific record.
rs.FindFirst "Field1 = '" & Forms!frm1!Field1 & "' AND Field2 = '" _
& Forms!frm1!Field2 & "'"
DoCmd.OpenForm "frm2", , , "Field1 = '" & Forms! frm1Field1 & "' AND
Field2 = '" _
& Forms!frm1!Field2 & "'"
The problem this method filters out all records but the one opened to. Even
if there may be 5 records the navigation button shows only 1 and I can not
view the other 4. Is there a means to open a form to a specific record yet
still view other records via the navigation button?

Thanks
 
You basically need to open the form and then go to relevant record, instead
of filtering.... something like this...

'Find the relevant pk value
dim i as integer, crit As string
crit = "Field1 = '" & Forms!frm1!Field1 & "' AND Field2 = '" _
& Forms!frm1!Field2 & "'"
i = dlookup("[PKField]", "TableName", crit)

docmd.openform "frm2"
docmd.gotocontrol "PKFieldControlName"
DoCmd.FindRecord i, acAnywhere, , acSearchAll, , acCurrent
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top