Thanks Terry, I will try it out first.
"Terry" wrote:
> Hello Kenny
> Where you put that code snippet depends on where it is going to be used from.
> If it will be used from multiple forms or other calls put it in a module,
> otherwise put it in the form where it is to be used.
> To put it in a module change the 'Sub ClientsToTransfer()' to Public Sub
> ClientsToTransfer(). To put it in a form change it to 'Private Sub
> ClientsToAdd()
>
> To ativate the Sub put a button on the form and in the Click event of the
> button put ClientsToTransfer
> HTH
> Terry
> You cal
>
> "kennykee" wrote:
>
> > 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)
|