Results 1 to 13 of 13
  1. #1
    Join Date
    Jun 2015
    Location
    Wales. Land of the sheep.
    Posts
    1,228

    Schduling form - Cant store value

    I want to create a form where a user has the option to do two things:



    1. Select a record from a combo box and have the corresponding date displayed (for view or amendment)
    2. Have the ability to select two dates (from + to) and then a list will appear with all the sites that have dates which fall within that parameter.

    My first problem with this is...

    I can create the combo box, it displays the records I want. But when it asks for me to select a value to use later, the next page is the final one where I name the box.

    It doesn't ask me where I want to save the value and I am unaware how I can use a "stored value" when I have no idea where it is stored.

    Hopefully someone can help. Thanks

    Andy.

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,550
    In your line: "it displays the records I want. But when it asks for me to select a value to use later, the next page is the final one where I name the box.
    do you mean, when you run the query, it will ask you to fill in a parameter?

    And queries dont save the value, if you are using a form, your value goes into a control on the form. (your combo box)
    it is 'stored' here for the query to read.

    select * from table where [state] = forms!frmFind!cboState

    Am I on the right track?

  3. #3
    Join Date
    Jun 2015
    Location
    Wales. Land of the sheep.
    Posts
    1,228
    Perfect; I didn't know how to reference the selection made in the box, but you are correct. I don't need to store this data just use it for the query.

    Thanks.

  4. #4
    Join Date
    Jun 2015
    Location
    Wales. Land of the sheep.
    Posts
    1,228
    >=[Forms]![schedulerF]![From_Date_TXT]&<=[Forms]![schedulerF]![to_Date_TXT]

    this contains an invalid syntax its saying.. any ideas what's wrong here~?

  5. #5
    John_G is offline VIP
    Windows 7 32bit Access 2010 32bit
    Join Date
    Oct 2011
    Location
    Ottawa, ON (area)
    Posts
    2,615
    "&" isn't correct - you have to use the word "AND"

  6. #6
    CJ_London is offline VIP
    Windows 8 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,929
    agree 'and' and but still not correct

    myField >= [Forms]![schedulerF]![From_Date_TXT] AND myField <= [Forms]![schedulerF]![To_Date_TXT]

    or

    myField BETWEEN [Forms]![schedulerF]![From_Date_TXT] AND [Forms]![schedulerF]![To_Date_TXT]

  7. #7
    Join Date
    Jun 2015
    Location
    Wales. Land of the sheep.
    Posts
    1,228
    Sorry I didn't realise you responded. I didn't get the notification.

    Here's what I currently have and it seems to work:

    >=[Forms]![schedulerF]![From_Date_TXT] And <=[Forms]![schedulerF]![to_Date_TXT]

    Is this okay or would you recommend changing it?


    Additionally; I would also like to run a query that looks from the current day and the following 7 days so we can see what's upcoming in the following week. How would I achieve this?

    thanks Andy

  8. #8
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,770
    Maybe:

    myField BETWEEN Date() AND Date() + 7
    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.

  9. #9
    Join Date
    Jun 2015
    Location
    Wales. Land of the sheep.
    Posts
    1,228
    Where you write my field is that for the SQL? I'm keen to understand the help you offer and I don't understand the MyField part.

    Other than that, thanks for your time. Ill give this a go today along with some other features.

  10. #10
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,770
    MyField is where you put your actual field name appropriate for the expression in SQL statement. Or in query design grid this is the field for which you apply the criteria.
    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.

  11. #11
    Join Date
    Jun 2015
    Location
    Wales. Land of the sheep.
    Posts
    1,228
    But when I'm entering the information into the criteria box on access, it would put in this code for me right? I might be asking stupid questions but I want to understand as much as possible.

    Thanks Andy

  12. #12
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,770
    Criteria is typed into the cell in Design View grid. Switch to SQL View to see the statement that is constructed.
    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.

  13. #13
    Join Date
    Jun 2015
    Location
    Wales. Land of the sheep.
    Posts
    1,228
    thanks june

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

Similar Threads

  1. Replies: 9
    Last Post: 04-01-2014, 05:06 PM
  2. Replies: 2
    Last Post: 12-02-2012, 09:14 PM
  3. Replies: 1
    Last Post: 11-05-2012, 11:26 PM
  4. Form design for tool store database
    By V760838 in forum Database Design
    Replies: 1
    Last Post: 02-11-2012, 08:09 AM
  5. Replies: 12
    Last Post: 12-01-2011, 10:28 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