Row Selection on form

G

Guest

Hi Everyone,

I have a form, listing Invoice Header data. One Invoice per line. On each
line is a button "Select". When the user presses that button, I want to call
another form and show all the invoice data.

How do I pass the Invoice Number , as displayed, from the row that the user
selected (pressed "Select" on).

Thanks in advance for all your kind help,
Pat.
 
S

Stefan Hoffmann

hi Pat,

Pat said:
How do I pass the Invoice Number , as displayed, from the row that the user
selected (pressed "Select" on).
Use the OpenArgs parameter:

Private Sub cmdSelect_Click()

DoCmd.OpenForm "Other",,,,,Me![InvoiceNumber]

End Sub


In your other form you can evaluate it:


Private Sub Form_Open(Cancel As Integer)

If Nz(OpenArgs, -1) > 0 Then
'passed a InvoiceNumber
End If

End Sub


Otherwise use the Filter or Where parameter of DoCmd.OpenForm.


mfG
--> stefan <--
 
G

Guest

Use the OpenForm command to pass the filter using the Where Condition

In the button OnClick event write the code

Dim MyCondition As String
' If the invoice type is string, use
MyCondition = "[Invoice field name in table] = '" & Me.[Invoice field Name
in form] & "'"

' If the invoice type is numeric, use
MyCondition = "[Invoice field name in table] = " & Me.[Invoice field Name in
form]

Docmd.OpenForm "FormName" , , , MyCondition
=========================================
If you just want to pass the invoice number to the other form, use the
OpenArgs to pass the value to the other form

Docmd.OpenForm "FormName" , , , , , , Me.[Invoice field Name in form]

In the second form you can use
Me.OpenArgs to retrieve the value you passed.
============================================
 

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