Transfering data between forms

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have the main form (tradeinfo) that has a field (tradeid) that has a
tracking number for the contact information for that trade. Then I have a
diffrent form (compperform) that store diffrent information for each trade.
How can I transfer the tracking number to the second form?
 
Kat,

The OpenForm method has a parameter (WhereCondition) which will filter the
recordset of the second form. I'll assume you have a button on the
tradeinfo form that opens the compperform form. If this is the case, the
code to open the second form to the record identified by the value in the
[tradeid] field is:

Private Sub cmd_Button_Click()

docmd.OpenForm "compperform", , ,"[tradeid] = " & me.tradeid

End sub

This assumes that the field [tradeid] is also the name of the control, and
that the value in that field is a numeric value. If it is a string, I would
write it as:

docmd.OpenForm "compperform", , ,"[tradeid] = " & chr$(34) & me.tradeid
& chr$(34)

HTH
Dale
 

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