Listbox recordsource value (1 Viewer)

jrjr

A work in progress
Local time
Today, 15:16
Joined
Jul 23, 2004
Messages
291
How do I determine what value my listbox has?

Here is what generates the records from Form 2:

Code:
If Not IsNull(Me.[StartDate]) And Not IsNull(Me.[EndDate]) Then
        strCriteria = strCriteria & "tblWO.Created Between #" & _
            Format(Me.[StartDate], "m/d/yyyy") & "# And #" & _
            Format(Me.[EndDate], "m/d/yyyy") & "#"

    strSql = "SELECT DISTINCT [WOnumber],[Requested],[UDF1],[RequestedBy]," & _
               "[Status],[property],[asset]" & _
               "FROM tblWO " & strCriteria

    Forms("frmFilter").Listbox1.RowSource = strSql

What I am trying to do is trigger a message box from the onclick of a command button on Form 2 and read the listbox # records on Form 1. It's gotta be something simple in my syntax. Search hasnt provided this scenario for me. I have tried these and more:

Code:
       'If Forms("frmFilter").RecordsetClone.RecordCount = 0 Then
        'If IsNull(Forms("frmFilter")).Listbox1 Then
        'If Forms("frmFilter").Listbox1.RowSource = 0 Then
        'If Forms("frmFilter").Listbox1.RowSource = Null Then
        'If [Forms]![FrmFilter]![Listbox1.recordcount] = 0 Then
        'If Forms("frmFilter").Listbox1.RecordCount = 0 Then
        'If Forms("frmFilter").Listbox1.RecordCount = "" Then
        'If Forms("frmFilter").Listbox1.RecordCount = Null Then 
         
          MsgBox "Sorry, no records meet your chosen dates. Change the dates and try again."
 

jrjr

A work in progress
Local time
Today, 15:16
Joined
Jul 23, 2004
Messages
291
I knew it was something simple. Thanks for the tip... it worked just fine. Here is what I ended up with:

If Forms("frmFilter").Listbox1.ListCount = 0 Then

Thanks again!!
:D
 

Users who are viewing this thread

Top Bottom