Results 1 to 7 of 7
  1. #1
    accessmatt is offline Competent Performer
    Windows 7 32bit Access 2010 32bit
    Join Date
    Aug 2011
    Posts
    199

    Need help troubleshooting a ComboBox to Query pass through

    Hello,

    I'm trying to use connect a ComboBox to a query, wherein picking a field in the ComboBox would pass a parameter that would filter my query. However it's not working. I''ve attached this to my ComboBox:



    Private Sub Combo65_Enter()
    DoCmd.OpenQuery "thisweek", acViewNormal
    End Sub
    and this in the Parameters of my Query:
    Like [Forms]![Timecard]![Combo65]
    All thats happening is that the query opens up but with no data in it! However i've confirmed multiple times and there is data for this time period. Any ideas?

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,902
    LIKE without wildcard is useless, just use = sign.

    Why open a query and not a form or report?

    I NEVER use dynamic parameterized queries, I pass filter criteria to form or report.

    What are properties of the combobox?
    RowSource
    ColumnCount
    ColumnWidths
    BoundColumn

    Post the full query SQL statement.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    accessmatt is offline Competent Performer
    Windows 7 32bit Access 2010 32bit
    Join Date
    Aug 2011
    Posts
    199
    Hi June7,

    My goal is to create a query which populates a sub-report which is housed inside a form. The combobox is a selector for a set of date ranges (the day and week mapping table). Please teach me out to pass filter criteria.

    ComboBox Properties:
    RowSource: SELECT [Day and Week Mapping].[ID], [Day and Week Mapping].[Week] FROM [Day and Week Mapping];
    ColumnCount: 2
    ColumnWidths: 0";1"
    BoundColumn: 1
    Full SQL:
    SELECT [Day and Week Mapping].Week, [Day and Week Mapping].[Day of Week], [Time Entry Matt].Brand, [Time Entry Matt].Description, [Time Entry Matt].[Hours Worked]FROM [Time Entry Matt] INNER JOIN [Day and Week Mapping] ON [Time Entry Matt].Date = [Day and Week Mapping].Day
    WHERE ((([Day and Week Mapping].Week) Like [Forms]![Timecard]![Combo65]));

    Thanks!

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,902
    Okay, a dynamic parameterized report used as sub on a form - never done that. Why a report and not form?

    Is the combobox on the main form or is it on another form that then opens the form/subreport?

    Aside from the LIKE instead of =, can't see anything wrong.

    Clarify 'not working' - what happens?
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  5. #5
    accessmatt is offline Competent Performer
    Windows 7 32bit Access 2010 32bit
    Join Date
    Aug 2011
    Posts
    199
    June7,

    I have an existing form for time entry and I basically just want to put a little box next to it which can be queried, through the Combobox located on the main form, for the week of entry, thereby assisting people in knowing how much time they've already entered. I've used subforms in the past, simply dragging a report onto a form creates a sub report, but it really doesn't matter to me if you have a better way. By not working I mean that no data is populated in my query after selecting in the Combobox. I originally thought this might be related to the fact that I'm using Enter() to pass the parameter but I've tried other actions as well to no avail. Of course, I've checked and that query should populate data.

  6. #6
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,902
    What might be required is a Requery or Refresh action on the subreport after the combobox selection.

    However, if the dynamic parameterized query doesn't work outside the form/subreport structure, then Refresh/Requery will be futile.

    If you want to provide db ...
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  7. #7
    accessmatt is offline Competent Performer
    Windows 7 32bit Access 2010 32bit
    Join Date
    Aug 2011
    Posts
    199
    Thanks June7, I'd appreciate that. Link to it on my cloud storage is here: http://goo.gl/iSbXO2.

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

Similar Threads

  1. Troubleshooting unmatched query
    By accessmatt in forum Queries
    Replies: 2
    Last Post: 09-29-2014, 01:52 PM
  2. Need Troubleshooting
    By athyeh in forum Programming
    Replies: 10
    Last Post: 09-26-2013, 12:16 PM
  3. Tab Control Troubleshooting
    By MayaMia in forum Forms
    Replies: 10
    Last Post: 10-09-2012, 12:32 PM
  4. Replies: 5
    Last Post: 04-19-2012, 09:35 AM
  5. Replies: 6
    Last Post: 07-21-2010, 11:47 AM

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