Rollover Form Data

  • Thread starter Thread starter Evan McCutchen
  • Start date Start date
E

Evan McCutchen

Hello everyone,

I have a form called "products" which contains info about the specific
products we have on site. On this form i have a button that opens up another
form "Invoices" to a new record. Is there a way that i can rollover the text
in the field "Company" on the "Products" form to the "Company" field on the
"Invoices" form?

Thanks in advance!
Evan McCutchen
(e-mail address removed)
 
make the default value for the field...

=[Forms]![Products]![Company]



Hello everyone,

I have a form called "products" which contains info about the specific
products we have on site. On this form i have a button that opens up another
form "Invoices" to a new record. Is there a way that i can rollover the text
in the field "Company" on the "Products" form to the "Company" field on the
"Invoices" form?

Thanks in advance!
Evan McCutchen
(e-mail address removed)
 
Evan,
When you open a form, you can do the following

Dim strFilter As String
strFilter = "[Company]=" & Me.Company
DoCmd.OpenForm "frmInvoices", FilterName:=strFilter

This takes advantage of the FilterName argument of DoCmd.OpenForm. Be aware
that this assumes that there is a "Company" field on the form where you have
the button (as well as the target form), and that this field is numeric on
both forms. If this is not the case and you probably have something like a
CompanyID then alter your code to look something like:

Dim strFilter As String
strFilter = "[CompanyID]=" & Me.CompanyID
DoCmd.OpenForm "frmInvoices", FilterName:=strFilter

Other ideas: Another argument of DoCmd.OpenForm you may want to try using
would be WhereCondition. For a real elaborate setup you could use OpenArgs
and put code in Form_Open of the target form to do something based on the
value of Me.OpenArgs.

Hope this will at least give you an idea of what to do,
Mattias Jonsson
 
Thanks for your assistance guys. I'll try those and see how it works.

Evan McCutchen
(e-mail address removed)
 
Back
Top