Page 2 of 2 FirstFirst 12
Results 16 to 26 of 26
  1. #16
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    No problemo.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  2. #17
    Sharkun is offline Novice
    Windows XP Access 2003
    Join Date
    Dec 2010
    Posts
    25

    One more question

    I'll try and stop bothering, but I have a follow up.

    I was hoping that I would be able to take what you fixed for me in the form search button and apply that to a different search form I'm doing.

    Your line of code here that works great:
    DoCmd.OpenReport stDocName, acPreview, , "Customer = '" & Me.Combo5.Column(1) & "'"

    So I have another form that's using the same report but searching by a different field.

    The combo box is named Combo0
    Column 4 is the column in the query I'm searching by.
    Problem ID is the name of the field in the report.

    So I would think that this line would work.

    DoCmd.OpenReport stDocName, acPreview, , "Problem ID = '" & Me.Combo0.Column(4) & "'"

    But I get a syntax error (missing operator) in query expression '(Problem ID = ")'

    Thanks again.

  3. #18
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    The error indicates that it isn't finding a value. Column number 4 is actually the 5th column in the combo, as the Column property is zero based. Perhaps you want 3? Also, if the ID is numeric, you don't want the surrounding single quotes, as noted in my link.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  4. #19
    Sharkun is offline Novice
    Windows XP Access 2003
    Join Date
    Dec 2010
    Posts
    25
    Tried different column numbers and still get syntax error. It is a text value, and tried different columns with no luck. Always a syntax error. What about the space in the column name. Should Problem ID have something to say that Problem & ID go together?

    Made another search form that I was going to do. And I get a blank report, but no data. This one's difference is the name of the column is all together with no spaces.

    DoCmd.OpenReport stDocName, acPreview, , "AssignedTo = '" & Me.Combo4.Column(7) & "'"

    To be clear and without bugging you for little things, in this situation, I have my query and it has 8 columns showing. If I want to search by the 7th column in the query it the Column(x) line x would be 6?

  5. #20
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    Because of the inadvisable space, you need to bracket the field name. The 7th column in the query would referred to as 6, yes. In case you modified things after initially building the combo, make sure the column count property is correct (in your example, it would need to be 8).
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  6. #21
    Sharkun is offline Novice
    Windows XP Access 2003
    Join Date
    Dec 2010
    Posts
    25
    Column Count Property?

    I bracketed in the Problem ID text, but no syntax error, but no data on the report.

    DoCmd.OpenReport stDocName, acPreview, , "[Problem ID] = '" & Me.Combo0.Column(3) & "'"

    The Column I'm searching by in the query is in the 4th column so that would be Column(3)

    What am i missing?

  7. #22
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    What is the Column Count property of the combo?
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  8. #23
    Sharkun is offline Novice
    Windows XP Access 2003
    Join Date
    Dec 2010
    Posts
    25
    1 is the value. I have the problem IDs in another table

  9. #24
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    Like I said, you need to change 1 to the number of fields being returned by the query.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  10. #25
    Sharkun is offline Novice
    Windows XP Access 2003
    Join Date
    Dec 2010
    Posts
    25
    I've gotten confused again.

    My combobox is linked to a table that has all my problem types. Not linked to the query. Here's examples of my table of problem types.

    Hardware
    Software
    Reports
    CC
    and so on like that.

    If i'm reading your last entries correct, in my combo-box the column count should be the number of columns that are in my query? Tried it, but still not working.

    Sorry to be a pain.

  11. #26
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    Can you post the db? With the column count property, you're telling Access how many fields there are. If your column count property is 1, then Access won't recognize when you refer to a column higher than that (actually 1 less than that, due to the zero base).
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

Page 2 of 2 FirstFirst 12
Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 29
    Last Post: 08-16-2011, 05:52 PM
  2. Replies: 0
    Last Post: 08-24-2010, 06:38 PM
  3. Filter By Form Report (combobox issue)
    By mike.burns7 in forum Reports
    Replies: 1
    Last Post: 06-10-2010, 07:42 PM
  4. Replies: 0
    Last Post: 12-16-2009, 01:14 PM
  5. Form Combobox filter
    By westcoastbmx in forum Forms
    Replies: 0
    Last Post: 10-20-2009, 11:27 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