Navigation GoTo Record

G

Guest

I have 2 forms (A & B) and when I move via macro button from form A record 3
I want to GoTo record 3 in form B.
 
G

Guest

Hi

You can either put code on the OnClick event of the button like this

Open your form in design view.
Select the button
Right click
In the properties box select Event column
Select OnClick
Select build (code)

it will look like this

Private Sub ButtonName_Click()

End Sub


Cut and paste this code inbetween the lines

DoCmd.Close
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "FormB"
stLinkCriteria = "[RecordNumber]=" & Me![RecordNumber]
DoCmd.OpenForm stDocName, , , stLinkCriteria


so that it looks like this

Private Sub ButtonName_Click()
DoCmd.Close
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "FormB"
stLinkCriteria = "[RecordNumber]=" & Me![RecordNumber]
DoCmd.OpenForm stDocName, , , stLinkCriteria
End Sub

Of course change the ButtonName to what it is and the RecordNumber and FormB
but leave everything else as it is

Or

Use a macro to open the form at the correct record

Open your form in design view.
Select the button
Right click
In the properties box select Event column
Select OnClick
Select build (macro)

In the action column
Select Open Form
In the box below select the name of the form you want to open
In the Where line put this
[RecordNumber] = Forms![FormB]![RecordNumber]

Change RecordNumber and FormB to what they areally are.

Hope this helps
 

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

Top