Results 1 to 10 of 10
  1. #1
    ggdoggie is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Jun 2014
    Posts
    4

    Really novice question regarding queries


    Hi all,

    I'm new to using ACCESS and have some very dumb questions that I'm afraid to ask my boss. She has set up multiple queries and when we were reviewing them she said to run them in a specific order. Looking in design view, i think the queries create and feed several other tables. My question is once I run a query, do I need to run it again everytime I want to update a table? So if query 1 runs and feeds data into table 1, query 1 might also feed data to table 2. Do i need to run query 1 again to update table 2? Do I ever need to run it again? Or once it's run, its done?

    Is there any way to tell the last time a query has been run? Can I run into problems if I run a query more than once?

    Again I apologize for the very simple questions, but I'm extremely frustrated with trying to learn. I will also watch some of the videos I saw posted

    Thanks!

  2. #2
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,847
    It appears from your questions that you may not have had sufficient training or practice or instructions to do what the boss has requested.
    Often, but not always, queries are run to select and display certain information from existing tables. Some queries are used to add, modify or delete records in tables. In some cases running the same query multiple times could be harmful to the database, but usually there are safeguards built into the application to prevent you from doing a Delete without asking for confirmation. However, some "user/developers" build things quick and dirty and don't include validation/verification and you could run a query a number of times and destroy the database.

    I don't think questions are dumb. You can always ask for clarification. Better to be clear in what is expected, than to do something in error.
    There are many good youtube videos that could help with understanding the various types of queries.
    Have you had any training in Access or database or the specific queries you are being asked to run?

  3. #3
    ggdoggie is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Jun 2014
    Posts
    4
    I took training online in house, but they weren't much help. I need real world, hands on experience to really learn how it works, but I'm afraid to mess things up. I'm scouring these forums for some helpful information.

    I run the same queries in the same order as my manager, yet I receive diff results. I'm very frustrated

  4. #4
    lfpm062010 is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Oct 2013
    Location
    US
    Posts
    415
    That is not unusual. If there are INSERT (add data), UPDATE (updata data), or DELETE (delete data) queries in the queries that you executed. It will change the results from one time to the next.

    If all your data are local (that mean the data is in the access database file that you are using) and not in SQL SERVER/ORACLE/etc, you can always make a copy of it and run each query and try to understand what each one does. If you stuck somewhere or mess up the order, you can always go back to the copy and start over.

  5. #5
    ggdoggie is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Jun 2014
    Posts
    4
    In general, if a query has already been run, do I need to run it again, or does it automatically save the results?

  6. #6
    lfpm062010 is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Oct 2013
    Location
    US
    Posts
    415
    There are 4 types of queries.

    1) SELECT - You can run as many times as you want. It just display report and will not change the underlying tables data.
    2) DELETE - Once it ran. It will delete whatever data matching the criteria. You can keep on running it and it will just keep on delete the data matching the criteria.
    3) INSERT - Once it ran. It will INSERT the new data in the table. Unless it failed due to duplicate records or some conversion failure.
    4) UPDATE - Once it ran. It will update (change) the data to whatever value that you are trying to update to. You can keep on running it and it will just keep on updating the value.

    So, in general. If a query has already been run, unless it is a SELECT query, it is not a good idea to run it again.

  7. #7
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,847
    I think it would be helpful if you could copy some of the queries (SQL view) you are running and post them within your post. That way readers can see the actual code and could offer more focused responses.
    Insert, Update and Delete queries are called action queries in Access. They can change a record or table.
    Select is normally ReadOnly and re-running should not affect the outcome ( providing nothing has been added,updated or deleted).

  8. #8
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,619
    DELETE, INSERT, UPDATE are action queries. One example case for their use is if you regularly receive data from some outside source and that data must be incorporated into the db table(s), that can be accomplished by running the action queries.

    Sequence can be important.

    Running the queries in proper sequence can be automated by code. Then you wouldn't have to remember the order each time.

    Do you know WHY these action queries are used in this 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.

  9. #9
    ggdoggie is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Jun 2014
    Posts
    4
    Here are 2 queries that I use. The "Monthly Qry 2" is used in many other queries, which is in the second example's script. I would like to know if Monthly Qry 2 needs to be run 1 time, or everytime I use another query that utilizes "monthly qry 2" will run it anyway? My fear is duplicating the data by accident.

    Monthly Qry 2:
    SELECT [Monthly Qry: FINMIS GWP].[Account Year], [Monthly Qry: FINMIS GWP].[2014 Final PC], [Monthly Qry: FINMIS GWP].[Account Month], [Monthly Qry: FINMIS GWP].MCC, [Monthly Qry: FINMIS GWP].[Policy Symbol], [Monthly Qry: FINMIS GWP].[W/R Code (Final Map)], [Monthly Qry: FINMIS GWP].[New/Renew Indicator], [Monthly Qry: FINMIS GWP].[Source Producer Code], [Monthly Qry: FINMIS GWP].[Source Producer Name], [Monthly Qry: FINMIS GWP].Broker, [Monthly Qry: FINMIS GWP].[Tracker Region], [Monthly Qry: FINMIS GWP].[CRS Producer Name], [Monthly Qry: FINMIS GWP].[Final BDM], [Account Year] & [Account Month] & "*" & [MCC] & "*" & [Broker] & "*" & [Final BDM] & "*" & [New/Renew Indicator] & "*" & [W/R Code (Final Map)] & "*" & [Tracker Region] AS [Sub Lookup], Sum([Monthly Qry: FINMIS GWP].[SumOfWritten Premium]) AS [SumOfSumOfWritten Premium], Sum([Monthly Qry: FINMIS GWP].SumOfCommission) AS SumOfSumOfCommission, [Monthly Qry: FINMIS GWP].Month, [Monthly Qry: FINMIS GWP].Quarter, [Monthly Qry: FINMIS GWP].[Business Unit]
    FROM [Monthly Qry: FINMIS GWP]
    GROUP BY [Monthly Qry: FINMIS GWP].[Account Year], [Monthly Qry: FINMIS GWP].[2014 Final PC], [Monthly Qry: FINMIS GWP].[Account Month], [Monthly Qry: FINMIS GWP].MCC, [Monthly Qry: FINMIS GWP].[Policy Symbol], [Monthly Qry: FINMIS GWP].[W/R Code (Final Map)], [Monthly Qry: FINMIS GWP].[New/Renew Indicator], [Monthly Qry: FINMIS GWP].[Source Producer Code], [Monthly Qry: FINMIS GWP].[Source Producer Name], [Monthly Qry: FINMIS GWP].Broker, [Monthly Qry: FINMIS GWP].[Tracker Region], [Monthly Qry: FINMIS GWP].[CRS Producer Name], [Monthly Qry: FINMIS GWP].[Final BDM], [Account Year] & [Account Month] & "*" & [MCC] & "*" & [Broker] & "*" & [Final BDM] & "*" & [New/Renew Indicator] & "*" & [W/R Code (Final Map)] & "*" & [Tracker Region], [Monthly Qry: FINMIS GWP].Month, [Monthly Qry: FINMIS GWP].Quarter, [Monthly Qry: FINMIS GWP].[Business Unit];

    Pivot Table Qry:
    SELECT [Account Year] & [Account Month] AS [Account YearMo], [Monthly Qry: 2].MCC, [Monthly Qry: 2].Broker, [Monthly Qry: 2].[Final BDM], [Monthly Qry: 2].[New/Renew Indicator], [Monthly Qry: 2].[W/R Code (Final Map)], [Monthly Qry: 2].[Tracker Region], [Monthly Qry: 2].[CRS Producer Name], [Monthly Qry: 2].[Sub Lookup] AS Expr1, Sum([Monthly Qry: 2].[SumOfSumOfWritten Premium]) AS [SumOfSumOfSumOfWritten Premium], Sum([Monthly Qry: 2].SumOfSumOfCommission) AS SumOfSumOfSumOfCommission
    FROM [Monthly Qry: 2]
    GROUP BY [Account Year] & [Account Month], [Monthly Qry: 2].MCC, [Monthly Qry: 2].Broker, [Monthly Qry: 2].[Final BDM], [Monthly Qry: 2].[New/Renew Indicator], [Monthly Qry: 2].[W/R Code (Final Map)], [Monthly Qry: 2].[Tracker Region], [Monthly Qry: 2].[CRS Producer Name], [Monthly Qry: 2].[Sub Lookup];

  10. #10
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,619
    SELECT queries don't need to be 'run' independently. A SELECT query won't cause anything to be duplicated. SELECT queries only read data, they don't change data. If you open another query, or a form, or a report that uses Monthly Qry 2, then that will 'run' the query and reflect existing data.
    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. Novice Needs Help With Simple Select Queries
    By GAtkins in forum Queries
    Replies: 5
    Last Post: 11-26-2013, 04:36 PM
  2. Novice question XML Custom Ribbon
    By Derrick T. Davidson in forum Programming
    Replies: 2
    Last Post: 04-06-2013, 09:56 AM
  3. Data sum novice question
    By DougTheSquid in forum Access
    Replies: 1
    Last Post: 10-13-2012, 12:45 PM
  4. Really Novice Question
    By AccessNoob1 in forum Forms
    Replies: 1
    Last Post: 04-07-2011, 09:44 AM
  5. Novice question about using established forms
    By runabout6 in forum Access
    Replies: 2
    Last Post: 08-23-2010, 09:00 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