Copy and create recordset

D

Downie

I have a SQLString that queries on three tables (form, subform, subform
of subform). I need to provide a button[Command51_Click()] that
essentially copies the current recordset into a new recordset. Any
suggestions???

CODE

Private Sub Command51_Click()

DoCmd.SetWarnings False

Dim SQLString As String
Dim cnn As New ADODB.Connection
Dim cmd As New ADODB.Command
Dim rst As New ADODB.Recordset

Set cnn = CurrentProject.Connection
Set cmd.ActiveConnection = cnn

SQLString = "SELECT backup.bac_id, backup.bac_system_id,
backup.bac_name, backup_schedule.bsc_id,
backup_schedule.bsc_schedule_name, backup_times.bat_time FROM
backup_times LEFT JOIN (backup RIGHT JOIN backup_schedule ON
backup.bac_id = backup_schedule.bsc_backup_id) ON
backup_times.bat_bsc_id = backup_schedule.bsc_id WHERE
(((backup.bac_id) = " & tbBacid & "));"

cmd.CommandText = SQLString
rst.CursorLocation = adUseClient
rst.Open cmd, , adOpenKeyset, adLockOptimistic

' MsgBox (rst.GetString)
' MsgBox (rst.RecordCount)

If rst.RecordCount > 0 Then

Me.Recordset
 
J

Jeff Boyce

Disregard the "cant do this with Access" message. It is SPAM (or worse).
Follow the link at your own peril...<g>

Regards

Jeff Boyce
Microsoft Office/Access MVP
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top