Use of Null or IsNull

ejhatch

Registered User.
Local time
Today, 02:33
Joined
Oct 12, 2005
Messages
26
Hi All,

I have written some code which is as follows:

Private Sub Command19_Click()
Dim stDocName As String

stDocName = Me.frmMain.Form.List10.Column(0)

If stDocName = Null Then
MsgBox ("Please select one of the queries to run")
Else

DoCmd.OpenQuery stDocName, acNormal, acEdit

End If
End Sub

------------------

The first problem is that I need to check to see whether the code has value for stDocName. How do I code the line to look for a blank value.

Once this is fixed and the user sees the message box pop up, I need the code to reset itself so that the routine is rerun again. How do I get the sub to rerun again. I almost need a "goto" statement. Do I use the refresh option.

Thanks,

Evan
 
Code:
Private Sub Command19_Click()
Dim stDocName As String

stDocName = Me.frmMain.Form.List10.Column(0)

If Len(Trim(stDocName)) = 0 Then
   MsgBox ("Please select one of the queries to run")
Else
   DoCmd.OpenQuery stDocName, acNormal, acEdit
End If
End Sub
Is the List10 ComboBox on a SubForm? After the user picks a ComboBox selection I'm sure they will push the Command button again.
 
Hi,

Firstly, thanks for the help on the Len function.

Yes, the List10 combo box is on a subform.

You're correct. Once the user gets the message and rechooses the query, the sub will be run again when he clicks the command button again.

Thanks once again for that.

Cheers,

Evan
 

Users who are viewing this thread

Back
Top Bottom