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

Append 3 Tables with TextBox Value 1

Status
Not open for further replies.

mibeach7

MIS
Jun 18, 2003
35
US

Hello again,

I have three tables all with a date field. When user enters a date into a text box, I want to click a button to insert a new record and the date value into 3 tables, all in the same query.

Do I have to open a recordset for each table .Addnew function.

Private Sub AddDateTable_Click()

Dim cnn As ADODB.Connection
Dim rs As ADODB.Recordset

Set cnn = CurrentProject.Connection
Set rs = New ADODB.Recordset

With rs
.Open "Customes", CurrentProject.Connection, adOpenKeyset, adLockOptimistic, adCmdTable
.AddNew
.Fields("StartDate") = Me.txtDate
.Update
.Close
End With
RS.Close
Cnn.Close
End Sub

? Do this three times or can I open 1 connection on three tables?

Thank for the help..

ron



 
You may consider 3 append queries:
DoCmd.RunSQL "INSERT INTO Customes (StartDate) VALUES (#" & Format(Me.txtDate, "m/d/yyyy") & "#)"

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top