Dear All,
Thanks for a great forum.
I want to make my buttons generic for all lists in my report forms.
I have several buttons and each list has their own, Appeals reports, DC reports ect.
The buttons do the exact same thing for all lists.
So I have a Run Report button, a Run Query button etc.
Please see the code below:
The
is want I want to make generic.
So I need code to recognise which List is currently selected and then make that a variable and then use the dot notation for that.
So for example
So the variables type has to be of list to get the dot notation.
Any help with the above would be greatly appreciated.
Thanks.
Thank you,
Kind regards
Triacona
Thanks for a great forum.
I want to make my buttons generic for all lists in my report forms.
I have several buttons and each list has their own, Appeals reports, DC reports ect.
The buttons do the exact same thing for all lists.
So I have a Run Report button, a Run Query button etc.
Please see the code below:
Code:
Private Sub EnRunQuery_Click()
On Error GoTo Err_EnRunQuery_Click
Dim stDocName As String
stDocName = ListEn.Column(2)
If Not QueryExists(stDocName) Then
MsgBox stDocName & " query doesn't exist, RUN the REPORT!", vbExclamation, "RUN The REPORT!!!"
ElseIf Not Me.txtEndDate.Enabled = True Then
DoCmd.OpenQuery stDocName, acNormal, acEdit
DoCmd.Maximize
ElseIf IsNull(Me.txtStartDate And Me.txtEndDate) Then
DoCmd.RunMacro "MsgBoxNoDate"
Else: DoCmd.OpenQuery stDocName, acNormal, acEdit
DoCmd.Maximize
End If
Exit_EnRunQuery_Click:
Exit Sub
Err_EnRunQuery_Click:
MsgBox Err.Description
Resume Exit_EnRunQuery_Click
End Sub
Code:
stDocName = ListEn.Column(2)
So I need code to recognise which List is currently selected and then make that a variable and then use the dot notation for that.
So for example
Code:
stDocName = CurrentList.Column(2)
Any help with the above would be greatly appreciated.
Thanks.
Thank you,
Kind regards
Triacona