Results 1 to 4 of 4
  1. #1
    abusaif is offline Advanced Beginner
    Windows 7 32bit Access 2010 64bit
    Join Date
    Nov 2012
    Location
    Earth
    Posts
    39

    listbox Error

    I created a listbox which is showing records from my query. now on double click i want it open employee edit form. My Code is as follow

    Private Sub lvwEmployees_DblClick(Cancel As Integer)


    Dim strA As String
    Dim strB As String


    strA = "frmEmployees"
    strB = "[CardNo]=" & Me.[lvwEmployees]

    DoCmd.OpenForm strA, , , strB

    End Sub
    Its popping up an error message " Syntax error (missing operator) in query expression '[CardNo]="1510'.
    Can any body help please?

  2. #2
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,917
    Sounds like your CardNo might be a string. Try:
    strB = "[CardNo]='" & Me.[lvwEmployees] & "'"

  3. #3
    abusaif is offline Advanced Beginner
    Windows 7 32bit Access 2010 64bit
    Join Date
    Nov 2012
    Location
    Earth
    Posts
    39

    Yes it worked thanks a lot friend.

  4. #4
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,917
    You're welcome. Glad we could help.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 3
    Last Post: 12-13-2012, 04:40 AM
  2. Replies: 1
    Last Post: 09-10-2012, 11:21 PM
  3. Replies: 1
    Last Post: 07-26-2012, 11:45 AM
  4. Replies: 0
    Last Post: 07-16-2012, 05:42 AM
  5. Replies: 7
    Last Post: 06-05-2012, 03:22 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums