GoToRecord=Same as other form

  • Thread starter Bradley C. Hammerstrom
  • Start date
B

Bradley C. Hammerstrom

Access2000

Still working on getting this to work . . .
Let's suppose two forms have same underlying query and are already opened.

The user is viewing a record on the first form that he wants to view more
detail in the second form (frmMain), so the user clicks a command button
(cmdGoToMain), and the already open second form goes to the same record. I
can use the Visible property to make the forms show when I want to, I just
need the second form to go to the same record.

Here is what I have in mind:
****************
Private Sub cmdGoToMain_Click()
Dim strFormName As String
Dim intRecNumber As Integer
strFormName = "frmMain"
intRecNumber = Me.Bookmark

DoCmd.GoToRecord acDataForm, strFormName, acGoTo, intRecNumber

End Sub
***************
I'm getting a mismatch error because Bookmark is a string, not an integer,
but the offset argument needs a number.
How do I do this?
I hope this is clear.
Brad H
 
T

tmac

I have a master form with three subforms. Subform 1, Subform2,
Subform3.



Subform1 is linked to catID of the master.

Subform 2&3 are linked to subform 1 records. When I click on a record
in subform1, 2&3 jump to the details.



Subform1 "On Current" has the following code

Sub Form_Current()



Dim ParentDocName As String



On Error Resume Next

ParentDocName = Me.Parent.Name



If Err <> 0 Then

GoTo Form_Current_Exit

Else

On Error GoTo Form_Current_Err

Me.Parent![Products by Category Subform2 Orders].Requery

Me.Parent![Products by Category Subform3 Detail].Requery

End If



Form_Current_Exit:

Exit Sub



Form_Current_Err:

MsgBox Error$

Resume Form_Current_Exit



End Sub



Subform 1,2 point to Products table. 3 points to inventory
transactions table.



Subform two is linked the following way

Child = [ProductID]

Master = [Products by Category Subform1 Products].Form![ProductID]





I linked the tables using the wizard. Subform1 is a datasheet list of
products and price, subform2 is the product detials, subform3 is the
inventory information.



hope that 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