0
votes

I have a form with a button that runs a macro that opens another form. Both are connected to the same table. I want the second form to display the same record as the first form.

I don't want to filter it to only the same record; I know how to do that. (I use the Where Condition box.) When the new form opens, I want to be able to navigate to the other records.

I tried this:

GoToRecord
Record: Go To
Offset: Forms![FirstForm]![ID] 

That gives an error, probably because the ID number isn't what I'm looking for; it's the record number.

So I tried this:

GoToRecord
Record: Go To
Offset: Forms![FirstForm].CurrentRecord 

But that doesn't work either.

I could probably do it in VBA, but I'd feel silly; I'm sure I'm just one keyword away from making this work.

1

1 Answers

1
votes

Ok, as noted, if you use the where clause (and in most cases you should), then of course you get one record, but as noted no navigation to other records.

For some reason I can't get the macro to work.

This VBA snip will work however:

  Private Sub Command84_Click()
  
      DoCmd.OpenForm "frmHotelsMain"
  
      Forms("frmHotelsMain").Recordset.FindFirst "ID = " & Me!ID
  
  End Sub

However, for some reason, the FindFirst in a macro don't work.

So, two lines of VBA.

I did try a macro with open form, and then a find record - it just does not seem to work.