Which row?

  • Thread starter Thread starter Guest
  • Start date Start date
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.
 
You don't say if this is a Continuous form. If it is, you can just refer to
the Invoice Number field directly, as the form knows which is the current
record. Something like:

DoCmd.OpenForm "form name",,,"[Invoice Number]=" & Me.txtInvoiceNumber

Of course, I don't know the name of your form, fields and controls, so
you'll need to put in your own names there. This assumes the form you're
opening is bound to the invoice data table; what you're doing is adding a
WHERE clause to the form's RecordSource when it opens, displaying only the
Invoice Number you're interested in.

If the form isn't bound to the invoice table, you can instead pass the
invoice number in the OpenArgs parameter of OpenForm and set the form's
RecordSource in the Form_Load event, using the passed invoice number.

HTH,

Carl Rapson
 
Hi Carl,

Thanks for your most helpfull comments. Yes, its a continuous form and in
the form properties, the data source is the Visit Header table. The "key" of
the table is "Visit_Key". When I click the "View Visit" button (where I call
another form to show the detail), I get a compile error "Method or Data
Member not found" indicating it doesn't like Me.Visit_Key.
I've tried doing a Me.Visit_Key.SetFocus first and that just moves the error.

Private Sub Command14_Click()
On Error GoTo Err_Command14_Click
Me.Visit_Key.SetFocus
DoCmd.OpenForm "One Visit", , , "[Log_Visit_Key]=" & Me.Visit_Key
Exit_Command14_Click:
Exit Sub
Err_Command14_Click:
MsgBox Err.Description
Resume Exit_Command14_Click
End Sub
 
Hi Carl,

Please disregard the last note - I got it - my problem was the most simple
of access errors - modifying the table after creating the form - you'd think
I'd know better by now -

Many Thanks for your kind help - I'm flying

Pat Backowski
 

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

Back
Top