A Microsoft Office (Excel, Word) forum. OfficeFrustration

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.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

From a form control, open another form relating to that record



 
 
Thread Tools Display Modes
  #1  
Old July 20th, 2007, 12:58 PM posted to microsoft.public.access.forms
CW
external usenet poster
 
Posts: 701
Default 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  
Old July 20th, 2007, 01:06 PM posted to microsoft.public.access.forms
Mr B
external usenet poster
 
Posts: 210
Default 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  
Old July 20th, 2007, 01:48 PM posted to microsoft.public.access.forms
CW
external usenet poster
 
Posts: 701
Default 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  
Old July 20th, 2007, 02:30 PM posted to microsoft.public.access.forms
Mr B
external usenet poster
 
Posts: 210
Default 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  
Old July 21st, 2007, 04:04 AM posted to microsoft.public.access.forms
Sarah0824
external usenet poster
 
Posts: 32
Default 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

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 11:52 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.