Free Lessons
Courses
Seminars
TechHelp
Fast Tips
Templates
Topic Index
Forum
ABCD
 
Home   Courses   TechHelp   Help   Contact   Merch   Join   Order   Logon   Forums   
 
Back to Access Forum    Comments List
Upload Images   @Reply   Bookmark    Link   Email   Next Unseen 
ListBox Value List going to next column
Ben Chua 
    
14 years ago
Private Sub Command0_Click()
        
    Dim db As Database
    Dim rs As Recordset
    Dim MyString As String
    Dim x As Integer
    
    On Error Resume Next
    
    For x = 1 To CADHrList.ListCount
    CADHrList.RemoveItem 0
    Next x
    
    Set db = CurrentDb
    
    MyString = "SELECT * FROM DisplayCADHoursQ WHERE FirstName='" & CurrentUsername & "' And WorkDate > #" & DateFrom & "# And WorkDate < #" & DateTo & "#"
    
    
    Set rs = db.OpenRecordset(MyString, dbOpenDynaset)
    
    CADHrList.AddItem "WorkLogID;WorkDate;TDJobNo;WorkType;ProjectName;CustomerName;CustNo;SPID;Specifier;Hours"
  
    While Not rs.EOF
        If IsNull(DateFrom) Or IsNull(DateTo) Then
'datefrom = the start date user required from displaycadhoursquery
'dateto = the end date user required from displaycadhoursquery
            MsgBox "No Range Date entered"
            Exit Sub
        End If

        CADHrList.AddItem rs!WorkLogID & ";" & rs!WorkDate & ";" & rs!TDJobNo & ";" & rs!WorkType & ";" & rs!ProjectName & ";" & rs!CustomerName & ";" & rs!AccountNo & ";" & rs!SalesRepID & ";" & rs!FN & ";" & rs!HoursWork

       rs.MoveNext

    Wend
    

    
    rs.Close
    db.Close
    
    Set rs = Nothing
    Set db = Nothing
    

    
    
End Sub


*** The problem happen always in the customername ***


Reply from Richard Rost:

Hmmm... it looks fine to me. Perhaps it's a NULL problem. Try enclosing all of your rs!FieldNames inside of NZ() functions, like this:

NZ(rs!CustomerName,"")

That should change them over to zero-length strings (or even try a single SPACE). I'd have to see the database or set it up myself to tell you anything further... unless someone else has any other ideas. Your code looks OK to me though.

This thread is now CLOSED. If you wish to comment, start a NEW discussion in Access Forum.
 

Next Unseen

 
New Feature: Comment Live View
 
 

The following is a paid advertisement
Computer Learning Zone is not responsible for any content shown or offers made by these ads.
 

Learn
 
Access - index
Excel - index
Word - index
Windows - index
PowerPoint - index
Photoshop - index
Visual Basic - index
ASP - index
Seminars
More...
Customers
 
Login
My Account
My Courses
Lost Password
Memberships
Student Databases
Change Email
Info
 
Latest News
New Releases
User Forums
Topic Glossary
Tips & Tricks
Search The Site
Code Vault
Collapse Menus
Help
 
Customer Support
Web Site Tour
FAQs
TechHelp
Consulting Services
About
 
Background
Testimonials
Jobs
Affiliate Program
Richard Rost
Free Lessons
Mailing List
PCResale.NET
Order
 
Video Tutorials
Handbooks
Memberships
Learning Connection
Idiot's Guide to Excel
Volume Discounts
Payment Info
Shipping
Terms of Sale
Contact
 
Contact Info
Support Policy
Mailing Address
Phone Number
Fax Number
Course Survey
Email Richard
[email protected]
Blog RSS Feed    YouTube Channel

LinkedIn
Copyright 2026 by Computer Learning Zone, Amicron, and Richard Rost. All Rights Reserved. Current Time: 8/17/2026 6:08:22 PM. PLT: 0s