Results 1 to 10 of 10
  1. #1
    Freddie81 is offline Competent Performer
    Windows 10 Access 2013 64bit
    Join Date
    Mar 2018
    Posts
    149

    Using Date values from Form for criteia in Query

    Click image for larger version. 

Name:	mainF.JPG 
Views:	15 
Size:	59.4 KB 
ID:	34709Click image for larger version. 

Name:	query.JPG 
Views:	15 
Size:	48.5 KB 
ID:	34710

    Hi Guys

    I'v got a bit of a hick up in my database. I've got a navigation form called MainF, and one of the nav buttons pens a form called ReportingF which is used to open various othe forms in a subform field called DS. As per my screenshot I'm trying to use a date picker to assign a start date and an end date for my reports to run via Queries. The dte fields are on the fom ReportingF.

    I need my query to get these values frm the form and run the query according to that criteria as per the second image. The criteia I used is in the image but it is not working, it gives me a blank datasheet but when I run the frm itself and then the quey it works.

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,524
    You said the form is ReportingF
    but your screenshot says MainF.

    the query needs ReportF.
    forms!reportingF!txtStartDate .....

  3. #3
    Freddie81 is offline Competent Performer
    Windows 10 Access 2013 64bit
    Join Date
    Mar 2018
    Posts
    149
    Nu uh, I said I have a Navigation form called MainF and it opens a new form called ReportingF inside it

    Itried using ReportingF in the query and when I use the for stand alone it works but whn used ia th navigation form it doesnt

  4. #4
    June7's Avatar
    June7 is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,899
    So the date controls are on ReportingF? Then why does your criteria expression reference just MainF? Show your code for referencing ReportingF. Review https://www.accessforums.net/showthread.php?t=32053
    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
    Freddie81 is offline Competent Performer
    Windows 10 Access 2013 64bit
    Join Date
    Mar 2018
    Posts
    149
    Hi June7I attemtep to try the query from MainF as it is the navigation forms name that the ReportingF form shows into when you click Reportig on the nav form

    If I have ReportingF open by itself the query works but when I use the navigation Form to access the reporting one it doesnt nd asks me to ente the values for the 2 text boxes fr dates

    This is what my query now looks like:
    Between [Forms]![ReportingF]![txtStartDate] And [Forms]![ReportingF]![txtEndDate]

  6. #6
    June7's Avatar
    June7 is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,899
    Did you review thread in the referenced link? Referencing subform whether on a normal or navigation form is different than referencing form opened independently. Same structure will not work.

    I do not use dynamic parameterized queries. I use VBA to set Filter property.
    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
    Freddie81 is offline Competent Performer
    Windows 10 Access 2013 64bit
    Join Date
    Mar 2018
    Posts
    149
    I just read it yes, thank you very much, the criteria you gve that guy with the navigationsubform works.

  8. #8
    Freddie81 is offline Competent Performer
    Windows 10 Access 2013 64bit
    Join Date
    Mar 2018
    Posts
    149
    Okay so I need to take it one level further lol

    Click image for larger version. 

Name:	navsubform.JPG 
Views:	7 
Size:	92.8 KB 
ID:	34726Click image for larger version. 

Name:	DS.JPG 
Views:	7 
Size:	104.2 KB 
ID:	34727
    So the code: Forms![MainF]![NavigationSubform].Form!controlname allows access to the date picker on the navigationsubform, but where from here do I go to get access to the combobox in the form underneath that loaded in DS? Ive tried all of the things I could from the availabe options and its not giving e the control name.

  9. #9
    Freddie81 is offline Competent Performer
    Windows 10 Access 2013 64bit
    Join Date
    Mar 2018
    Posts
    149
    Im trying this code in my query but its not working ither lol. I need the quey to only show th records for the specific customer selected in cboCustomr on the form.

    "[CustomerName]='" & [Forms]![MainF]![NavigationSubform].[Form].[Controls]![DS].[Form].[cboCustomer] & "'"

  10. #10
    June7's Avatar
    June7 is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,899
    No idea. I don't use Navigation form.

    If you want to provide db for analysis, follow instructions at bottom of my post.
    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.

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

Similar Threads

  1. Sum Date/Time values in a query
    By Amras in forum Programming
    Replies: 1
    Last Post: 03-28-2016, 05:08 PM
  2. Replies: 2
    Last Post: 01-25-2016, 10:25 AM
  3. Matching date values .. in query
    By edmscan in forum Queries
    Replies: 3
    Last Post: 07-22-2014, 09:45 AM
  4. Query for sum of values by date
    By Mattbro in forum Queries
    Replies: 2
    Last Post: 07-15-2013, 08:34 AM
  5. Default Min & Max Date Values in Form
    By alsoto in forum Forms
    Replies: 3
    Last Post: 10-03-2011, 10:54 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