N
NEWER USER
I have a toolbar that I want to assign to multiple forms that are viewed in
Datasheet view mode only. I have assigned a Function on the toolbar to run an
On Acxtion command. Each form has a different Recordsource (qryAll,
qryTotals, qryParts, etc). The following works well on one form only. As the
form and Recordsource change, I need to be able to recognize the current
Recordsouce so I don't have to create a separate toolbar for each form only
to change qryAll to qryTotals. Any help appreciated.
Function QTag()
Dim strWhere As String
Dim strMsg As String
With CodeContextObject
strWhere = "WHERE " & .Filter
End With
strMsg = "FILTERED records will be tagged."
If (MsgBox(strMsg, 273, "Warning") <> 1) Then
'Tag filtered records on form
DoCmd.CancelEvent
Exit Function
End If
DoCmd.SetWarnings False
'This is where I need to vary the recorsource below
DoCmd.RunSQL "UPDATE qryAll " & _
"SET qryAll.T = '-1'" & strWhere
DoCmd.Requery
DoCmd.SetWarnings True
End Fuction
Datasheet view mode only. I have assigned a Function on the toolbar to run an
On Acxtion command. Each form has a different Recordsource (qryAll,
qryTotals, qryParts, etc). The following works well on one form only. As the
form and Recordsource change, I need to be able to recognize the current
Recordsouce so I don't have to create a separate toolbar for each form only
to change qryAll to qryTotals. Any help appreciated.
Function QTag()
Dim strWhere As String
Dim strMsg As String
With CodeContextObject
strWhere = "WHERE " & .Filter
End With
strMsg = "FILTERED records will be tagged."
If (MsgBox(strMsg, 273, "Warning") <> 1) Then
'Tag filtered records on form
DoCmd.CancelEvent
Exit Function
End If
DoCmd.SetWarnings False
'This is where I need to vary the recorsource below
DoCmd.RunSQL "UPDATE qryAll " & _
"SET qryAll.T = '-1'" & strWhere
DoCmd.Requery
DoCmd.SetWarnings True
End Fuction