Value listbox

sven2

Registered User.
Local time
Today, 16:43
Joined
Apr 28, 2007
Messages
297
Hello,

behind a listbox there is an SQL than gives a value to this listbox ...
something like

strSQL = " SELECT COUNT(Personeelsnummer) "

This is working like it should but now if the listbox is empty or the value is 0 I want to generate a msgbox ...

I tried something like this but it isn't working:

If Len(Me.txtcontroleaantal & "") = 0 Or Me.txtcontroleaantal.Value = 0 Then

How can I do this the right way?

Thanks in advance,
Sven.
 
In stead of using sql, I would set the after update property of the listbox to something like this :

Code:
Private Sub Yoursub()

    If IsNull(Me.txtcontroleaantal) Then
        MsgBox "Please, blah , blah ", 
        Me.txtcontroleaantal.SetFocus
        Exit Sub
    End If

End Sub

Hth
 
Hello,

the problem is the following:

I use this SQL behind a listbox:

strSQL = " SELECT COUNT(Personeelsnummer) "
strSQL = strSQL & " FROM Cursusdeelnemers "
strSQL = strSQL & " WHERE [Uitnodiging afdrukken?] = 1 "
strSQL = strSQL & " AND Planningsnummer = " & Me.txtplanningsnummer & " "
Me.txtcontroleaantal.RowSource = strSQL

The result of this query can be 4 or something else and this is visible on the screen but when I put this me.txtcontroleaantal in a msgbox I get an error like "the value is null".

What is the reason for this?

Because I want to use this value of me.txtcontroleaantal in vba ...

Sven.
 

Users who are viewing this thread

Back
Top Bottom