Results 1 to 2 of 2

Thread: Sql statement and combo box

  1. #1

    Thread Starter
    New Member
    Join Date
    Apr 2000
    Posts
    10

    Talking

    Hello everyone
    I have tried to use a sql statement in access, where the field is a combo box. I load the query and write

    SELECT * FROM TblOne WHERE field1 = 'choice'

    field1 is a combo box.
    The query does not work. what you think I might be doing wrong?

  2. #2
    Addicted Member
    Join Date
    May 2000
    Location
    London Occupation: Desktop Developer
    Posts
    141
    Not clear on when you want to excecute this query but I think the following syntax will work. (Note you do not need the single quotes if your field data type is numeric - text only)


    "SELECT * FROM TblOne WHERE field1 = '" & me.combo & "'"

    If you want to refresh the recordsource of a form for example this could go in the afteupdate event of the combo box as so:

    me.recordsource = "SELECT * FROM TblOne WHERE field1 = '" & me.combo & "'"

    Hope this helps?




Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width