Results 1 to 3 of 3
  1. #1
    tagteam is offline Competent Performer
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2013
    Posts
    494

    Best way to run query AFTER checking criteria

    I would like to run an append query but only after I have checked a table for existing data. I want to see if a ralicarID exists in a table and if it doesnt the query should run. if the railcarid does exist but also has a check in and check out date then the query can also run.



    I am not very good at programming but I was thinking something like this

    Dim RailcarInDatabase as number
    ' run query here that checks for the railcar id and returns a value
    if railcarID in table then RailcarInDatabase =1 else RailcarInDatabase =0
    And if If RailcarID in table and DateInShop is not null and DateOutShop is not null then RailcarInShop = 0

    Something like that which will allow me to run the query only if the car is not in the database or it is currently not in the shop.

    Any help is appreciated.

  2. #2
    orange's Avatar
    orange is online now Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,850
    Sounds reasonable from 30000 feet. But we need more info re your "business rules/facts" and a picture of your tables and relationships.

  3. #3
    tagteam is offline Competent Performer
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2013
    Posts
    494
    Well I have been thinking about it and I think it will be easier to just create a new checkbox called InShop. Then when the button is clicked it will start the query and select the InShop checkbox. if the box is already selected it will stop the query and give the user a message that it is in the shop. Then I dont have to worry about checking the dates.

    That will make it a simple if statement. If InShop = True then quit else run query.

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

Similar Threads

  1. Replies: 4
    Last Post: 08-30-2014, 10:23 AM
  2. Replies: 5
    Last Post: 08-02-2012, 09:44 AM
  3. Checking which query is invoking inputbox?
    By ravenq1 in forum Queries
    Replies: 1
    Last Post: 01-12-2012, 05:05 PM
  4. checking a query when marking a checkbox
    By vt800c in forum Access
    Replies: 2
    Last Post: 05-13-2011, 08:53 AM
  5. Checking for Value in Query
    By jgelpi in forum Access
    Replies: 1
    Last Post: 06-24-2009, 04:57 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