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

more tables in a form without using subform or query

Status
Not open for further replies.

ezuria

Programmer
Apr 25, 2000
11
0
0
MY
I have a situation here whereby I need to include 3 tables in a form without having to use subform becuase there are already too many subforms exist.I can't use query as well because the form shall require data entry. Please help me.<br>Thank you in advance.
 
The only way to do this is have all of the Text boxes on your form &quot;Unbound&quot;. Then write VBA code to add the data from each text box to the correct table<br><br>Look in Help for adding records using VBA<br><br>Very basic concept here:<br>---------------------------<br>&nbsp;&nbsp;&nbsp;&nbsp;Dim MyDB As Database, MySet As Recordset<br>&nbsp;&nbsp;&nbsp;&nbsp;Dim MySet2 As Recordset<br>&nbsp;&nbsp;&nbsp;&nbsp;Dim MySet3 As Recordset<br>&nbsp;&nbsp;&nbsp;&nbsp;Set MyDB = CurrentDb<br>&nbsp;&nbsp;&nbsp;&nbsp;<br>&nbsp;&nbsp;&nbsp;&nbsp;Set MySet = MyDB.OpenRecordset(&quot;Table1&quot;)&nbsp;&nbsp;&nbsp;&nbsp;' &lt;&lt;&lt;&lt; your 3 tables here<br>&nbsp;&nbsp;&nbsp;&nbsp;Set MySet2 = MyDB.OpenRecordset(&quot;Table2&quot;)&nbsp;&nbsp;&nbsp;&nbsp;' &lt;&lt;&lt;&lt; Notice the &quot;2&quot; on Myset<br>&nbsp;&nbsp;&nbsp;&nbsp;Set MySet3 = MyDB.OpenRecordset(&quot;Table3&quot;)&nbsp;&nbsp;&nbsp;&nbsp;' &lt;&lt;&lt;&lt; Notice the &quot;3&quot; on Myset<br>&nbsp;&nbsp;&nbsp;&nbsp;<br>&nbsp;&nbsp;&nbsp;&nbsp;' Add new records to each table<br>&nbsp;&nbsp;&nbsp;&nbsp;MySet.AddNew<br>&nbsp;&nbsp;&nbsp;&nbsp;MySet2.AddNew<br>&nbsp;&nbsp;&nbsp;&nbsp;MySet3.AddNew<br>&nbsp;&nbsp;&nbsp;&nbsp;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;' Insert data to fields in each table<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;MySet![Some Field In Table1] = Me![Some Text box on your form]<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;MySet2![Some Field In Table2] = Me![Second Text box on your form]<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;MySet3![Some Field In Table3] = Me![Third Text box on your form]<br>&nbsp;&nbsp;&nbsp;&nbsp;<br>&nbsp;&nbsp;&nbsp;&nbsp;' Must HAVE to commint the records to save.<br>&nbsp;&nbsp;&nbsp;&nbsp;MySet.Update<br>&nbsp;&nbsp;&nbsp;&nbsp;MySet2.Update<br>&nbsp;&nbsp;&nbsp;&nbsp;MySet3.Update<br>-----------------------<br><br>OK<br> <p>DougP<br><a href=mailto: dposton@universal1.com> dposton@universal1.com</a><br><a href= > </a><br> Ask me how Bar-codes can help you be more productive.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top