button to open form

mcgraw

Registered User.
Local time
Today, 14:33
Joined
Nov 13, 2009
Messages
77
I have a button called btnVendor that I want on click to open the form [Vendor Details] where the vendor is = value of the current record.

So, I attempted this:

Code:
Private Sub btnVendor_Click()
DoCmd.OpenForm [Vendor Details], , , "Issues.Vendor = Vendor.ID"
End Sub

Currently when I click the button it doesn't do anything at all. How can I get it to open the form where the vendor matches what is in the current record?

Many thanks!
 
Hi:


Try;

form1

DoCmd.OpenForm "Vendor Details", acNormal, , , , , Nz(Me.ID,0)

form2

Private Sub Form_Open(Cancel As Integer)
If IsNull(Me.OpenArgs) Or Me.OpenArgs = 0 Then
Exit Sub
Else
Me.Filter = "ID=" & OpenArgs
Me.FilterOn = True
End If
End Sub
 
Last edited:

Users who are viewing this thread

Back
Top Bottom