Dear All,
I have a frustrating problem.
I want to check if the text box is visible
if it is not I just want it to output to excel.
If it is visible then I want it to check if it is blank.
If it is blank I want it to output a msgbox
The code is below:
the error message I get when the text box is disabled and not visible is:
Any help would really be much appreciated.![[smile] [smile] [smile]](/data/assets/smilies/smile.gif)
Kind regards
Triacona
I have a frustrating problem.
I want to check if the text box is visible
if it is not I just want it to output to excel.
If it is visible then I want it to check if it is blank.
If it is blank I want it to output a msgbox
The code is below:
Code:
Dim stDocName As String
stDocName = ListBcReports
If txtStartDate.Visible And txtStartDate.Enabled = True Then
txtStartDate.SetFocus
If txtStartDate.Text = "" Then
DoCmd.RunMacro "MsgBoxNoDate"
Else: DoCmd.OutputTo acOutputReport, stDocName, acFormatXLS, ListBcReports & ".xls", True
End If
Else: DoCmd.OutputTo acOutputReport, stDocName, acFormatXLS, ListBcReports & ".xls", True
End If
You can't reference a property or method for a control unless the control has the focus
Any help would really be much appreciated.
![[smile] [smile] [smile]](/data/assets/smilies/smile.gif)
Kind regards
Triacona