saledo2000
Registered User.
- Local time
- Today, 17:08
- Joined
- Jan 21, 2013
- Messages
- 94
Hi everyone,
I have a checkbox on a form with record from REG table, which I use to copy current records from one table to a temporary table which changes every day. I have set checkbox on click event to execute a VBA code to copy these record with append query:
Private Sub FL_chkbox_Click()
Dim FL_chkbox As String
If Me!FL_chkbox = True Then
DoCmd.OpenQuery "Append RegToFL"
ElseIf Me!FL_chkbox = False Then
DoCmd.OpenQuery "FL_Delete"
End If
Exit_here:
Exit Sub
Err_Handler:
MsgBox Err.Description, vbExclamation, "Error"
Resume Exit_here
End Sub
But I have subform SF_FM in continuous view with records from another table FM where I would like to copy current records from SF_FM which are related to the first table REG (one to many).
I have found some code to count current records on a subform but how to combine it with my IF statement. Code is:
Dim rs As DAO.Recordset
With Me.SF_FM.Form
DoCmd.SetWarnings False
Set rs = .RecordsetClone 'Get underlying subform records
rs.MoveFirst 'Start at first record
Do Until rs.EOF 'Until last record
.Bookmark = rs.Bookmark 'Navigate to current record
DoCmd.OpenQuery "Append FMToFL"
rs.MoveNext 'Next record
Loop
End With
DoCmd.SetWarnings True
Thank you.
I have a checkbox on a form with record from REG table, which I use to copy current records from one table to a temporary table which changes every day. I have set checkbox on click event to execute a VBA code to copy these record with append query:
Private Sub FL_chkbox_Click()
Dim FL_chkbox As String
If Me!FL_chkbox = True Then
DoCmd.OpenQuery "Append RegToFL"
ElseIf Me!FL_chkbox = False Then
DoCmd.OpenQuery "FL_Delete"
End If
Exit_here:
Exit Sub
Err_Handler:
MsgBox Err.Description, vbExclamation, "Error"
Resume Exit_here
End Sub
But I have subform SF_FM in continuous view with records from another table FM where I would like to copy current records from SF_FM which are related to the first table REG (one to many).
I have found some code to count current records on a subform but how to combine it with my IF statement. Code is:
Dim rs As DAO.Recordset
With Me.SF_FM.Form
DoCmd.SetWarnings False
Set rs = .RecordsetClone 'Get underlying subform records
rs.MoveFirst 'Start at first record
Do Until rs.EOF 'Until last record
.Bookmark = rs.Bookmark 'Navigate to current record
DoCmd.OpenQuery "Append FMToFL"
rs.MoveNext 'Next record
Loop
End With
DoCmd.SetWarnings True
Thank you.
Last edited: