Opening a form from another form

B

Bruce

This is very similar to a question I posted a few days
ago. I received a response, which led me to more
questions, but I have not received any further response in
that thread, so am starting a new one based on the
original, the response, and my follow-up question.
I have a form (frmVendorInfo) that displays information
about a vendor. At the top of the form is a box
(FindVendor)to select the vendor. That control is a drop-
down list. Its Row Source is a SQL statement, I think
(SELECT DISTINCTROW [etc.]). Somebody else started the
form, so I'm not sure. Anyhow, once the vendor is
selected, other information (address, phone, etc.) from
the selected record populates the rest of the form. I
have another form (frmVendorFax) 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 frmVendorInfo that when
clicked will open frmVendorFax. 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.
I posted a similar question a few days ago, and received
one answer that said what I needed to do was to put a
command button on frmVendorInfo that opens frmVendorFax,
and that the On Open event for frmVendorFax needs to
contain a script. The script provided was:
' declare variables
Dim strVendor as String
Dim strFilter as String

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

' apply filter
DoCmd.ApplyFilter , strFilter

However, [VendorIDControl] is not one of my fields, nor is
[VendorID]. Perhaps the person who responded assumed I
would understand what I needed to do, but there is a
reason I am posting in the Getting Started forum.
By the way, I am a relative beginner, but I understand
some of the basics such as how to set up an event
procedure.
 
C

Cheryl Fischer

Bruce,

The person who sent you the code in response to your question intended that
you change the form and control names he or she used to the names you are
using. Sometimes we forget to say that.

As to opening a form to find records in another table related to your
current record ... have you tried using the Command Button Wizard? When
you drag a command button to your form's design the Wizard's prompts will:

1. Ask you what operation you want to perform. You would select Form
Operations from the list box labeled "Categories".
2. When you select "Form Operations", the list box labeled "Actions" will
then show you available actions for forms. You would select "Open Form".
3. The next prompt will show you a list of forms from which to select.
4. After you select the desired form, the next prompt will ask you: "Do
you want the button to find specific information to display in the form?"
5. For the kind of operation you describe in your post, you would need to
select the first-listed option: "Open the form and find specific data to
display."
6. The next prompt will show you fields from your Main form in the
left-hand list box and fields from the selected form in the right-hand list
box. All you have to do is identify the field from the Main form which
should match the field in the selected form, click on each and then click on
the button ( <=> ) between the list boxes.
7. Click "Next" and answer the prompts about naming your button - and you
are done. Access will have written all the code you need to open the
desired form with records that will match your Main form.

hth,

--
Cheryl Fischer
Law/Sys Associates
Houston, TX

Bruce said:
This is very similar to a question I posted a few days
ago. I received a response, which led me to more
questions, but I have not received any further response in
that thread, so am starting a new one based on the
original, the response, and my follow-up question.
I have a form (frmVendorInfo) that displays information
about a vendor. At the top of the form is a box
(FindVendor)to select the vendor. That control is a drop-
down list. Its Row Source is a SQL statement, I think
(SELECT DISTINCTROW [etc.]). Somebody else started the
form, so I'm not sure. Anyhow, once the vendor is
selected, other information (address, phone, etc.) from
the selected record populates the rest of the form. I
have another form (frmVendorFax) 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 frmVendorInfo that when
clicked will open frmVendorFax. 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.
I posted a similar question a few days ago, and received
one answer that said what I needed to do was to put a
command button on frmVendorInfo that opens frmVendorFax,
and that the On Open event for frmVendorFax needs to
contain a script. The script provided was:
' declare variables
Dim strVendor as String
Dim strFilter as String

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

' apply filter
DoCmd.ApplyFilter , strFilter

However, [VendorIDControl] is not one of my fields, nor is
[VendorID]. Perhaps the person who responded assumed I
would understand what I needed to do, but there is a
reason I am posting in the Getting Started forum.
By the way, I am a relative beginner, but I understand
some of the basics such as how to set up an event
procedure.
 
B

Bruce

Thanks so much for your help. That did the trick, and
much simpler than I would have thought. I tend not to
trust wizards, but that one works really well. Can I copy
the code to the On Click event for a label? Control
buttons do not have background color options, as far as I
can figure out, and I would like to maintain the form's
existing color choices by using a formatted label as a
command button. I know I can make the current button
transparent and put it in front of a label that is
formatted to look like a button, but I would prefer to
avoid that.
-----Original Message-----
Bruce,

The person who sent you the code in response to your question intended that
you change the form and control names he or she used to the names you are
using. Sometimes we forget to say that.

As to opening a form to find records in another table related to your
current record ... have you tried using the Command Button Wizard? When
you drag a command button to your form's design the Wizard's prompts will:

1. Ask you what operation you want to perform. You would select Form
Operations from the list box labeled "Categories".
2. When you select "Form Operations", the list box labeled "Actions" will
then show you available actions for forms. You would select "Open Form".
3. The next prompt will show you a list of forms from which to select.
4. After you select the desired form, the next prompt will ask you: "Do
you want the button to find specific information to display in the form?"
5. For the kind of operation you describe in your post, you would need to
select the first-listed option: "Open the form and find specific data to
display."
6. The next prompt will show you fields from your Main form in the
left-hand list box and fields from the selected form in the right-hand list
box. All you have to do is identify the field from the Main form which
should match the field in the selected form, click on each and then click on
the button ( <=> ) between the list boxes.
7. Click "Next" and answer the prompts about naming your button - and you
are done. Access will have written all the code you need to open the
desired form with records that will match your Main form.

hth,

--
Cheryl Fischer
Law/Sys Associates
Houston, TX

This is very similar to a question I posted a few days
ago. I received a response, which led me to more
questions, but I have not received any further response in
that thread, so am starting a new one based on the
original, the response, and my follow-up question.
I have a form (frmVendorInfo) that displays information
about a vendor. At the top of the form is a box
(FindVendor)to select the vendor. That control is a drop-
down list. Its Row Source is a SQL statement, I think
(SELECT DISTINCTROW [etc.]). Somebody else started the
form, so I'm not sure. Anyhow, once the vendor is
selected, other information (address, phone, etc.) from
the selected record populates the rest of the form. I
have another form (frmVendorFax) 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 frmVendorInfo that when
clicked will open frmVendorFax. 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.
I posted a similar question a few days ago, and received
one answer that said what I needed to do was to put a
command button on frmVendorInfo that opens frmVendorFax,
and that the On Open event for frmVendorFax needs to
contain a script. The script provided was:
' declare variables
Dim strVendor as String
Dim strFilter as String

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

' apply filter
DoCmd.ApplyFilter , strFilter

However, [VendorIDControl] is not one of my fields, nor is
[VendorID]. Perhaps the person who responded assumed I
would understand what I needed to do, but there is a
reason I am posting in the Getting Started forum.
By the way, I am a relative beginner, but I understand
some of the basics such as how to set up an event
procedure.


.
 
C

Cheryl Fischer

Hi Bruce,

Perhaps I have had a bit too much Starbuck's today (or maybe not enough!),
but I do not see a Click Event for a label.

I tend to take a conservative, "less is more" approach to the use of color
in applications, so I am not the best person to ask about this.

--
Cheryl Fischer
Law/Sys Associates
Houston, TX

Bruce said:
Thanks so much for your help. That did the trick, and
much simpler than I would have thought. I tend not to
trust wizards, but that one works really well. Can I copy
the code to the On Click event for a label? Control
buttons do not have background color options, as far as I
can figure out, and I would like to maintain the form's
existing color choices by using a formatted label as a
command button. I know I can make the current button
transparent and put it in front of a label that is
formatted to look like a button, but I would prefer to
avoid that.
-----Original Message-----
Bruce,

The person who sent you the code in response to your question intended that
you change the form and control names he or she used to the names you are
using. Sometimes we forget to say that.

As to opening a form to find records in another table related to your
current record ... have you tried using the Command Button Wizard? When
you drag a command button to your form's design the Wizard's prompts will:

1. Ask you what operation you want to perform. You would select Form
Operations from the list box labeled "Categories".
2. When you select "Form Operations", the list box labeled "Actions" will
then show you available actions for forms. You would select "Open Form".
3. The next prompt will show you a list of forms from which to select.
4. After you select the desired form, the next prompt will ask you: "Do
you want the button to find specific information to display in the form?"
5. For the kind of operation you describe in your post, you would need to
select the first-listed option: "Open the form and find specific data to
display."
6. The next prompt will show you fields from your Main form in the
left-hand list box and fields from the selected form in the right-hand list
box. All you have to do is identify the field from the Main form which
should match the field in the selected form, click on each and then click on
the button ( <=> ) between the list boxes.
7. Click "Next" and answer the prompts about naming your button - and you
are done. Access will have written all the code you need to open the
desired form with records that will match your Main form.

hth,

--
Cheryl Fischer
Law/Sys Associates
Houston, TX

This is very similar to a question I posted a few days
ago. I received a response, which led me to more
questions, but I have not received any further response in
that thread, so am starting a new one based on the
original, the response, and my follow-up question.
I have a form (frmVendorInfo) that displays information
about a vendor. At the top of the form is a box
(FindVendor)to select the vendor. That control is a drop-
down list. Its Row Source is a SQL statement, I think
(SELECT DISTINCTROW [etc.]). Somebody else started the
form, so I'm not sure. Anyhow, once the vendor is
selected, other information (address, phone, etc.) from
the selected record populates the rest of the form. I
have another form (frmVendorFax) 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 frmVendorInfo that when
clicked will open frmVendorFax. 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.
I posted a similar question a few days ago, and received
one answer that said what I needed to do was to put a
command button on frmVendorInfo that opens frmVendorFax,
and that the On Open event for frmVendorFax needs to
contain a script. The script provided was:
' declare variables
Dim strVendor as String
Dim strFilter as String

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

' apply filter
DoCmd.ApplyFilter , strFilter

However, [VendorIDControl] is not one of my fields, nor is
[VendorID]. Perhaps the person who responded assumed I
would understand what I needed to do, but there is a
reason I am posting in the Getting Started forum.
By the way, I am a relative beginner, but I understand
some of the basics such as how to set up an event
procedure.


.
 
B

Bruce

Thanks for replying. If I insert a label directly from
the Control Toolbox it has a click event. The label that
tags along with a text box does not. I did not make my
meaning clear. I tend to agree that less is more with
colors, but at the same time I sometimes like to have a
choice other than gray. It was more a question for
general reference than for this particular situation.
-----Original Message-----
Hi Bruce,

Perhaps I have had a bit too much Starbuck's today (or maybe not enough!),
but I do not see a Click Event for a label.

I tend to take a conservative, "less is more" approach to the use of color
in applications, so I am not the best person to ask about this.

--
Cheryl Fischer
Law/Sys Associates
Houston, TX

Thanks so much for your help. That did the trick, and
much simpler than I would have thought. I tend not to
trust wizards, but that one works really well. Can I copy
the code to the On Click event for a label? Control
buttons do not have background color options, as far as I
can figure out, and I would like to maintain the form's
existing color choices by using a formatted label as a
command button. I know I can make the current button
transparent and put it in front of a label that is
formatted to look like a button, but I would prefer to
avoid that.
-----Original Message-----
Bruce,

The person who sent you the code in response to your question intended that
you change the form and control names he or she used to the names you are
using. Sometimes we forget to say that.

As to opening a form to find records in another table related to your
current record ... have you tried using the Command Button Wizard? When
you drag a command button to your form's design the Wizard's prompts will:

1. Ask you what operation you want to perform. You would select Form
Operations from the list box labeled "Categories".
2. When you select "Form Operations", the list box labeled "Actions" will
then show you available actions for forms. You would select "Open Form".
3. The next prompt will show you a list of forms from which to select.
4. After you select the desired form, the next prompt will ask you: "Do
you want the button to find specific information to display in the form?"
5. For the kind of operation you describe in your
post,
you would need to
select the first-listed option: "Open the form and
find
specific data to
display."
6. The next prompt will show you fields from your Main form in the
left-hand list box and fields from the selected form in the right-hand list
box. All you have to do is identify the field from the Main form which
should match the field in the selected form, click on each and then click on
the button ( <=> ) between the list boxes.
7. Click "Next" and answer the prompts about naming
your
button - and you
are done. Access will have written all the code you
need
to open the
desired form with records that will match your Main form.

hth,

--
Cheryl Fischer
Law/Sys Associates
Houston, TX

This is very similar to a question I posted a few days
ago. I received a response, which led me to more
questions, but I have not received any further
response
in
that thread, so am starting a new one based on the
original, the response, and my follow-up question.
I have a form (frmVendorInfo) that displays information
about a vendor. At the top of the form is a box
(FindVendor)to select the vendor. That control is a drop-
down list. Its Row Source is a SQL statement, I think
(SELECT DISTINCTROW [etc.]). Somebody else started the
form, so I'm not sure. Anyhow, once the vendor is
selected, other information (address, phone, etc.) from
the selected record populates the rest of the form. I
have another form (frmVendorFax) 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 frmVendorInfo that when
clicked will open frmVendorFax. 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.
I posted a similar question a few days ago, and received
one answer that said what I needed to do was to put a
command button on frmVendorInfo that opens frmVendorFax,
and that the On Open event for frmVendorFax needs to
contain a script. The script provided was:
' declare variables
Dim strVendor as String
Dim strFilter as String

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

' apply filter
DoCmd.ApplyFilter , strFilter

However, [VendorIDControl] is not one of my fields,
nor
is
[VendorID]. Perhaps the person who responded assumed I
would understand what I needed to do, but there is a
reason I am posting in the Getting Started forum.
By the way, I am a relative beginner, but I understand
some of the basics such as how to set up an event
procedure.



.


.
 

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