Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Dynamically change RowSource Type

Status
Not open for further replies.

Valeriya

MIS
Jan 9, 2006
138
US
I have a bit of a problem. My form has a ListBox that gets populated with a result of a query. Sometimes the query returns a zero-string so the value in a my listbox become just a blank (In all other cases it is a numeric value). That does not look proffesional. What I want is to populate my list box with a numeric zero (0)insted of having the listbox show a blank. This is my code:

Code:
Private Sub GoToNxt_Click()
On Error GoTo Err_GoToNxt_Click

DoCmd.GoToRecord , , acNext
   
   
   strSQL2 = " SELECT Count([0006 In Bin and Not Counted].[TID#]) AS [CountOfTID#]" & _
                   " FROM [0006 In Bin and Not Counted]" & _
                   " GROUP BY [0006 In Bin and Not Counted].Cust, [0006 In Bin and Not Counted].Comment" & _
                   " HAVING [0006 In Bin and Not Counted].Comment Like 'Inter*' " & _
                   " AND [0006 In Bin and Not Counted].Cust = " & Me.Cust.Value & ";"
                   
   [b]   If Len(strSQL2) > 0 Then
         List100.RowSource = strSQL2
         
         Else
                  
         List100.RowSourceType = "Value List"
         List100.RowSource = 0
         
         End If
    [/b]     
         
          
       
Exit_GoToNxt_Click:
    Exit Sub
    
    

Err_GoToNxt_Click:
    MsgBox Err.Description
    Resume Exit_GoToNxt_Click
    
End Sub

Thanks in advance!
 
Hello:

You just need to add the quotes around the zero

List100.RowSource = "0"

Regards

Mark

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top