G
Guest
Hi all.
The following code is from "Transportation For Data !!" post and from a
professional David C. Holley.
Sub AddClientsToTransfer()
Dim targetRecordSet As DAO.Recordset
Dim sourceRecordset As DAO.Recordset
'Grab the records to copy
Set sourceRecordset = Me.RecordsetClone
'Open up the table that the records will be added to
Set targetRecordSet = CurrentDb.OpenRecordset("tblTransferGuests")
'Loop through the records to be copied and copy them to the table
While Not sourceRecordset.EOF
targetRecordSet.AddNew
targetRecordSet("lngTransportId") = sourceRecordset("lngTransportID")
targetRecordSet("txtAirline") = sourceRecordset("cboAirlineDefault")
targetRecordSet("txtFlightNumber") = sourceRecordset("txtFlightNumberDefault")
targetRecordSet("dteFlightTime") = sourceRecordset("dteFlightTimeDefault")
targetRecordSet("txtCity") = sourceRecordset("txtCityDefault")
targetRecordSet("lngClientId") = sourceRecordset("lngClientId")
targetRecordSet.Update
sourceRecordset.MoveNext
Wend
Set targetRecordSet = Nothing
Set sourceRecordset = Nothing
Me.Requery
End Sub
Can anyone explain to me which one is the variable (text box) and where to
put these code and do i need any module added before it?
For further information please look at my last post on "Transportation For
Data !!"
Thanks in advance.
Kennykee (newbie in VBA)
The following code is from "Transportation For Data !!" post and from a
professional David C. Holley.
Sub AddClientsToTransfer()
Dim targetRecordSet As DAO.Recordset
Dim sourceRecordset As DAO.Recordset
'Grab the records to copy
Set sourceRecordset = Me.RecordsetClone
'Open up the table that the records will be added to
Set targetRecordSet = CurrentDb.OpenRecordset("tblTransferGuests")
'Loop through the records to be copied and copy them to the table
While Not sourceRecordset.EOF
targetRecordSet.AddNew
targetRecordSet("lngTransportId") = sourceRecordset("lngTransportID")
targetRecordSet("txtAirline") = sourceRecordset("cboAirlineDefault")
targetRecordSet("txtFlightNumber") = sourceRecordset("txtFlightNumberDefault")
targetRecordSet("dteFlightTime") = sourceRecordset("dteFlightTimeDefault")
targetRecordSet("txtCity") = sourceRecordset("txtCityDefault")
targetRecordSet("lngClientId") = sourceRecordset("lngClientId")
targetRecordSet.Update
sourceRecordset.MoveNext
Wend
Set targetRecordSet = Nothing
Set sourceRecordset = Nothing
Me.Requery
End Sub
Can anyone explain to me which one is the variable (text box) and where to
put these code and do i need any module added before it?
For further information please look at my last post on "Transportation For
Data !!"
Thanks in advance.
Kennykee (newbie in VBA)