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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

New form with existing values

Status
Not open for further replies.

cwebb

Technical User
Feb 7, 2000
5
US
I have created a button on a form to go to a new blank record form. I would like for the new form to contain the Company Name and Company ID. The user will fill in the remaining information. In the place I am now, I can save the form but it will not put these two items in the table. What can I do?
 
You can populate these two fields in the form_beforeinsert event.<br>
<br>
Private sub form_beforeinsert(Cancel As Integer)<br>
CompanyName=&quot;CompanyName&quot;<br>
CompanyID=&quot;CompanyID&quot;<br>
end sub<br>
<br>
Once users begin typing in data in any other field, these two fields will be populated.<br>

 
The above is great if the user doesn't need to see the fields. If they do, you can set the values in the field's Default Property. <br>
<br>
Also wanted to point out that if the CompanyID and CompanyName are already present in another table, you do not want to put both fileds into the second table. Just put the ID in. If you want to insert the ID but have it show as Name, you can change the contro to a combobox witha RowSource property that is a query (select CompanyID, CompanyName from tblCompany). Set the combobox's ColumnCount property to 2 and the ColumWidths to 0;x (x being the width needed to display the name).
 
I am trying to go to a new record form carrying the Business Name and Business ID over from the previous form. The table that this form saves to is being added on to. The table (BusContacts) will not always have the Business Name and ID. Those are found in another table (BusDev). I need the new form to find those and bring them into the new record form and then allow me to save the new form and information into the other table (BusContacts). The user needs to be able to see the Business Name at all times.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top