Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Open another form and Get ID from Main Form

Status
Not open for further replies.

khicon73

MIS
Jan 10, 2008
36
Hello all, please help...I'm very appreciated.
I have a main form listing all customer information

Example:

Main Form: "frm_Customer"

CustomerID = 08-00145 (txtCustomerID)
Customer LasName = Doe (txtLastName)
Customer FirstName = John (txtFirstName)
and some other fields....


and a button named "cmdContact". When click on "cmdContact", another screen open with new form named "frmContact" . This form is a continuous form linked "Customer ID" from Main Form.
If this form has 2 records in there then it will show:

CustomerID = 08-00145 (txtCustomerID)
Contact ID= 1 (txtContactID)
Date =12/1/2008 (txtEntryDate)
and some other fields...

CustomerID = 08-00145 (txtCustomerID)
Contact ID= 2 (txtContactID)
Date =12/3/2008 (txtEntryDate)
and some other fields....

From this, you can add a new record with
CustomerID = 08-00145 (automatic get this ID from Main form, main form is still open)
The rest users need to fill in datas...

So how can I get the CustomerID from main form if adding new records, please help...thanks alots



 
on form open

me.CustomerID.defaultvalue=forms!frm_Customer.customerid
 
if you always use the continous form in this manner, you can simply set the default value of customer ID to the field on the main form. Use the expression builder to build the default value, and select the form and the control.
 
Thanks pwise and MajP for your advise...It works...Thanks a million...
 
Hi Folks, I also have a similar challenge. I have 2 forms: main details form and additional info form. I have a combo box on the main form containing yes/no. What I want to achieve is if user select "yes" then the second form should pop up. If user selects no then "no" then action takes place.

How can I use an event procedure (macro) to do.
A quick response will be very much appreciated cheers.
Moses
 
Something like:
Code:
Private Sub Combo1_Click()
If Combo1.Value = "Yes" Then
    ' Show form2
ElseIf Combo1.Value = "No" Then
    ' Do other stuff
End If
End Sub
Hope this helps

HarleyQuinn
---------------------------------
The most overlooked advantage to owning a computer is that if they foul up there's no law against wacking them around a little. - Joe Martin

Get the most out of Tek-Tips, read FAQ222-2244 before posting.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top