If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
From a form control, open another form relating to that record
In our Job Control system I have a Customers table that stores all the usual
info about each company, and a corresponding form ("CorporateDataForm") where this data is maintained. On the Billing form for each job record there is a control (a combo) showing the name of the Customer for that particular job. Next to this I would like to place a command button that opens the CorporateDataForm for that customer (i.e. the customer on the current record). I have created the played around with some code behind the OnClick event for the button including using Me. but cannot get it to work... can some kind person please tell me exactly how this should be coded??? Thanks a lot! CW |
#2
|
|||
|
|||
From a form control, open another form relating to that record
Try:
Docmd.OpenForm "NameOfYourForm" -- HTH Mr B email if needed to: draccess at askdoctoraccess dot com "CW" wrote: In our Job Control system I have a Customers table that stores all the usual info about each company, and a corresponding form ("CorporateDataForm") where this data is maintained. On the Billing form for each job record there is a control (a combo) showing the name of the Customer for that particular job. Next to this I would like to place a command button that opens the CorporateDataForm for that customer (i.e. the customer on the current record). I have created the played around with some code behind the OnClick event for the button including using Me. but cannot get it to work... can some kind person please tell me exactly how this should be coded??? Thanks a lot! CW |
#3
|
|||
|
|||
From a form control, open another form relating to that record
Thanks, but that just opens an empty Corporate Data Form.
What I need is to open the form relating to the Company that is shown in the control on the current customer record. For example: the Jobs form is currently showing the job for Mr Smith. The Company control on Mr Smith's job is showing XYZ Inc. I want to open the Corporate Data Form for XYZ Inc. Thanks again CW "Mr B" wrote: Try: Docmd.OpenForm "NameOfYourForm" -- HTH Mr B email if needed to: draccess at askdoctoraccess dot com "CW" wrote: In our Job Control system I have a Customers table that stores all the usual info about each company, and a corresponding form ("CorporateDataForm") where this data is maintained. On the Billing form for each job record there is a control (a combo) showing the name of the Customer for that particular job. Next to this I would like to place a command button that opens the CorporateDataForm for that customer (i.e. the customer on the current record). I have created the played around with some code behind the OnClick event for the button including using Me. but cannot get it to work... can some kind person please tell me exactly how this should be coded??? Thanks a lot! CW |
#4
|
|||
|
|||
From a form control, open another form relating to that record
You'll need to add a "where" perameter to the statement.
Take a look in the Access help file for OpenForm to get the correct syntax. The name of the field and the value you want to see will be based on the value is being strored in your combo box. For example, if your combo box returns the actual Customer name then you can use: Docmd.openform "NameOFYourForm" , , , "NameOfCustomerNameField = Me.NameOfYourComboBox" Watch out for line wraping with the code above. -- HTH Mr B "CW" wrote: Thanks, but that just opens an empty Corporate Data Form. What I need is to open the form relating to the Company that is shown in the control on the current customer record. For example: the Jobs form is currently showing the job for Mr Smith. The Company control on Mr Smith's job is showing XYZ Inc. I want to open the Corporate Data Form for XYZ Inc. Thanks again CW "Mr B" wrote: Try: Docmd.OpenForm "NameOfYourForm" -- HTH Mr B email if needed to: draccess at askdoctoraccess dot com "CW" wrote: In our Job Control system I have a Customers table that stores all the usual info about each company, and a corresponding form ("CorporateDataForm") where this data is maintained. On the Billing form for each job record there is a control (a combo) showing the name of the Customer for that particular job. Next to this I would like to place a command button that opens the CorporateDataForm for that customer (i.e. the customer on the current record). I have created the played around with some code behind the OnClick event for the button including using Me. but cannot get it to work... can some kind person please tell me exactly how this should be coded??? Thanks a lot! CW |
#5
|
|||
|
|||
From a form control, open another form relating to that record
This may be a bit elementary, but when I first started doing this in my forms
(I do it quite often), I used the command button on the toolbox. The wizard that opens walks you through how to find a related record in the form you are opening. At first I found that easier until I started to learn more about writing my own code. Maybe that will work for you as well. "Mr B" wrote: You'll need to add a "where" perameter to the statement. Take a look in the Access help file for OpenForm to get the correct syntax. The name of the field and the value you want to see will be based on the value is being strored in your combo box. For example, if your combo box returns the actual Customer name then you can use: Docmd.openform "NameOFYourForm" , , , "NameOfCustomerNameField = Me.NameOfYourComboBox" Watch out for line wraping with the code above. -- HTH Mr B "CW" wrote: Thanks, but that just opens an empty Corporate Data Form. What I need is to open the form relating to the Company that is shown in the control on the current customer record. For example: the Jobs form is currently showing the job for Mr Smith. The Company control on Mr Smith's job is showing XYZ Inc. I want to open the Corporate Data Form for XYZ Inc. Thanks again CW "Mr B" wrote: Try: Docmd.OpenForm "NameOfYourForm" -- HTH Mr B email if needed to: draccess at askdoctoraccess dot com "CW" wrote: In our Job Control system I have a Customers table that stores all the usual info about each company, and a corresponding form ("CorporateDataForm") where this data is maintained. On the Billing form for each job record there is a control (a combo) showing the name of the Customer for that particular job. Next to this I would like to place a command button that opens the CorporateDataForm for that customer (i.e. the customer on the current record). I have created the played around with some code behind the OnClick event for the button including using Me. but cannot get it to work... can some kind person please tell me exactly how this should be coded??? Thanks a lot! CW |
Thread Tools | |
Display Modes | |
|
|