Filtering Records Problem

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
 
R

Rob Oldfield

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

Similar Threads

Changing Form's View in VBA 1
RecordsetClone Problems 1
updated field 3
Requery and Navigation 1
Hiding a Form- help 3
Form Search Help Please? 10
Trouble resetting subform after update 1
Report layout problem 2

Top