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

Adding a Record at run time 1

Status
Not open for further replies.

Jengo

Programmer
Apr 17, 2000
100
US
How to add a record to a table and add the info at run time then update the table so the record appears.
 
Try this in VBA:<br><br>Dim rstTable as Recordset<br><br>Set rstTable = Currentdb().OpenRecordset(&quot;tblYourTable&quot;)<br><br>With rstTable<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;.AddNew<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;!Field1 = MyField1<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;!Field2 = MyField2<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;.Update<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;.Close<br>End With<br><br>Me.Refresh<br><br><br>(More info provided would have given me more to work with, so if this doesn't make sense, give me more info!)<br>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top