Calling one form from another

B

Bruce

I have a form (Vendor Info) that displays information
about a vendor. At the top of the form is a box to select
the vendor. Once the vendor is selected, the rest of the
information (address, phone, etc.) populates the rest of
the form. I have another form (Vendor Fax) that will send
a fax to a vendor, but so far the only way to select the
vendor is with the record selector at the bottom of the
form. I want to place a command button on the Vendor Info
form that when clicked will open the Vendor Fax form. I
can do this to the extent of getting the Vendor Fax form
to open, but I do not know how to tell Vendor Fax to use
the currently selected record for company name, fax
number, and other fields. Right now I still have to
scroll through all of the records until I get to the one I
want.
 
H

Howard Brody

Place a CommandButton on frmVendorInfo that opens
frmVendorFax (but keeps frmVenforInfo open in the
background).

In the OnOpen event for frmVendorFax, filter the form for
the selected vendor:

' declare variables
Dim strVendor as String
Dim strFilter as String

strVendor = [Forms]![frmVendorInfo]![VendorIDControl]
strFilter = "[VendorID] = '" & strVendor & "'"

' apply filter
DoCmd.ApplyFilter , strFilter

Hope this helps!

Howard Brody
 
B

Bruce

Thanks for the help, but I still have questions. As I
understand it, [VendorIDControl] and [VendorID] in your
script are fields, but I cannot figure out which ones.
The row source for the drop down list at the top of the
Vendor Info form is a SQL statement, I think (SELECT
DISTINCTROW...). (Somebody else started the database.)
Is that control's name (FindVendor) part of your script?
When I changed the word [VendorIDControl] in the script to
[FindVendor], when I clicked the button to open the fax
form I got through the debugger which had formerly stalled
at [VendorIDControl] to an Enter Parameter Value dialog
box for VendorID. It feels like progress, but in what
direction I am not sure. Any further help would be
greatly appreciated.
-----Original Message-----
Place a CommandButton on frmVendorInfo that opens
frmVendorFax (but keeps frmVendorInfo open in the
background).

In the OnOpen event for frmVendorFax, filter the form for
the selected vendor:

' declare variables
Dim strVendor as String
Dim strFilter as String

strVendor = [Forms]![frmVendorInfo]![VendorIDControl]
strFilter = "[VendorID] = '" & strVendor & "'"

' apply filter
DoCmd.ApplyFilter , strFilter

Hope this helps!

Howard Brody
-----Original Message-----
I have a form (Vendor Info) that displays information
about a vendor. At the top of the form is a box to select
the vendor. Once the vendor is selected, the rest of the
information (address, phone, etc.) populates the rest of
the form. I have another form (Vendor Fax) that will send
a fax to a vendor, but so far the only way to select the
vendor is with the record selector at the bottom of the
form. I want to place a command button on the Vendor Info
form that when clicked will open the Vendor Fax form. I
can do this to the extent of getting the Vendor Fax form
to open, but I do not know how to tell Vendor Fax to use
the currently selected record for company name, fax
number, and other fields. Right now I still have to
scroll through all of the records until I get to the one I
want.
.
.
 

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