Queries :: Run Update Query Externally On Any Database?
May 12, 2015
I have a database that updates daily. Each day I need to set the values of certain columns back to zero. At the moment I'm doing this manually and it's taking time since I have to update a number of columns. Very simple, I just create an update query, update to 0, run it and done.What I'm wondering is if there is any way to do this with a click of a button external to Access? Like export the update query to the desktop, double click it and it just updates those columns to zero.
The file location is always the same and the table structure is always the same (one table with about 40 columns of numbered data) but, the database is newly generated daily. So if I save the update query today, when it's generated tomorrow, I have to create it again as it's a new database.
I was thinking maybe a batch file to open access, open the database and then run the query but I think this would only work if the query was within the database and since it's newly generated daily, it won't work.if it's possible to export an update query somehow so I can click on it and apply it to the new database each day. As above, the structure and tables/names are the same very day.
I have been trying to figure out a way to export my forms as a webpage or an exe that can be used without having Access installed. A database I am workingon currently needs to be utilized by hundreds of people and I wish for them all to not have to have access.
I have tried exporting a form as a webpage and creating a new data access page but nothing is quite the same.
I have a database which will contain sensitive data, but as part of that database there is a table which contains a case number (related the case table) and three different costs (Cost 1, Cost 2 & Cost 3), I would like to be able to use the email collection service in Access, to send our Finance guy the table, have him fill the costs for each case and send it back, without him having access to the rest of the db.
I have been trying to set this up but the html form the wizard outputs, is well... a form, only allowing one of each cost to be entered.Is there a way to bend the email function to my will or am I going to have to do it another way?
I'm relatively new to MS Access (using MS Access 2013 but the db should work on 2010, too) and try to develop a database for an NGO I'm working in. [...].
However now I start to create forms and later reports for the actual user. The database will store information about clients and track consultations and assistance the NGO gives to them. There will be around 50.000 to 70.000 clients in the main table. Every client has a specific Individual ID and is member of a family which itself has another specific Group ID.
So now, I am almost done with forms (at least I want to believe that). But I ran into an issue I would love to have your comment and different approach on:
The Database I create is projected on another, significantly bigger database! The one I create is a kinda light version for other field offices with only the information they need to have, and additional tables for them to gather their own data and track their own activities. This being said, the light database needs to be updated every month once by the big (mother version). Both DBs cannot be connected!!!
So we will send to the field offices altogether 5 tables in one mdb-file every month. These 5 tables exist with the same structure ( name, field data-types, etc.) in the light version.
I now want to make an automatic update option (by pressing a key and select the "update-file"), i.e. based on the the respective Primary Key of every table the entry in the smaller DB should be updated!
Update for me means the following three things (Assume big DB is A, small DB is B):
1) If Primary Key (PK) exists in both tables of A and B, update the rest of the fields in B belonging to that key based on the specific record of A
2) If PK does not exist in A but in B, delete record from the database B (case: record was deleted in A after last update)
3) If PK does not exist in B but in A, add the record to database B (case: record was added to database A after last update)
I would like to show you what I already found in the internet on solving task 1) but I cannot post links due to my status.
Both links basically describe how to update one table by another in importing or linking the update-source table in the current DB, create a query with both tables, link the PKs of both and then using the Update To Criteria [UpdateSourceTable].[Field] for each field that I want to update.
But I wanted to ask before I implemented that if I should make a complete different approach since I also have 2) and 3) as tasks....
I am building a stakeholder database in Microsoft access 2010 and I want to be able to say that a stakeholder attended an event. I have managed to do this but I can only say that one stakeholder attended an event at one time. This is quite a problem as there can be up to 800 or even more stakeholders attending an event so to go through and click each one would be very time consuming.
My current set up is I have a stakeholder table an events table and an event attendance table. It all works fine apart from only being to edit one record at a time. I have tried update queries with no success, I can attach the database but would need to remove the data for data protection reasons.
I run a physical therapy office and patients come in for treatment either 3, 4 or 5 times per week. My database is used to track these frequencies (among other things).
I have 3 queries which count how many patients come in 5, 4 and 3 times/week.
In my main table I have fields called "how many 5's", "how many 4's" and "how many 3's".
I have tried to design an update query which will update those fileds in my main table to reflect the counts in the 3 queries mentioned above.
(I'm not using SQL view, I'm using the query design view)
In the "update to:" row, I use the Build function and locate the count I'm looking for.
Problem: when I run the query I get the error: Operation must use an updateable query.
I am facing problem regarding updating of certain field of table. For example i would like to take data from a column of Table1 and would like insert that data into particular column in Table2.
Suppose Table One has data:
Table 1 ID Name amount 1 a 0 34 b 0 3 ab 0
Table2 ID Name amount 34 a 400 1 b 900 3 ab 4500
There are about 2000 records in each table.I would like to update column "Amount" of Table1 by taking data from Table2 "Amount" Field. how can i update the amount column by keeping the ID field?
im working on an update query (written in VB coding) for one of my tables, for now im just setting the value to 1 (as currently all the data is set to 0, so for now it works), however id like to improve upon the query and get it to add 1 every time instead of setting it to 1 (i can work with it the way it is, but changing it would give me more info)
currently its at DoCmd.RunSQL "UPDATE tblBatches SET tblBatches.batchCarryover = 1;"
I have 2 tables that hold similar data. In one table tblMultiSchedule I have a few blank columns. I want to update each column(ActualCost*) with the correct data which is stored in tblOrdersItems. the corresponding fields in each tbl are
possible to have an update query to only update 20 rows with a new data in the fields? And, how do I pass the information that I want to update only data from a certain date.If I have the word Cat and want to update it to Dog, but only with the dates 12-01-2014, where do I need to put the date part (also possible to do this for dates that are greater than 12-01-2014).
Now I have huge data from tbl_bill which contains mix PONumber depends on type. If bill_type is type1 then it will get data from tbl_type1 table and vise versa. the problem is tbl_type1 and tbl_type2 is changing, when someone update this table then the data in tbl_bill will not match to 2 tables.
Now, i need an update query where I can update all records of tbl_bill to match with tbl_type1 and tbl_type2 PONumber.
I have created the tables I need for my Access Web App.I would like to create queries.I cannot update fields that show in the query (fields have a grey frame and cannot be edited) . I have even created a completely new app with only 1 table (no relationships whatsoever in case this may influence). It is still not possible to edit any field in a query (that would update the underlying table). Are there any general settings in Access I need to enable? Is there a setting in Sharepoint I need to enable?
I can do this in like 5 seconds in SQL Server but I can't get the query to even ALLOW me to update records.
Table1 - Columns Query1 - ColumnDesc
Code: SELECT DISTINCT C.Column FROM Columns C INNER JOIN ( SELECT Cols.Column, Count(Cols.DataType) FROM (SELECT DISTINCT Columns.Column, Columns.DataType FROM Columns) Cols WHERE Cols.DataType = 'char' OR Cols.DataType = 'varchar' GROUP BY Cols.Column HAVING Count(Cols.DataType) > 1 ) C2 ON C.Column = C2.Column;
Simple, straight forward query, that grabs all the rows from table Columns where there are more than one DataType per Column [name], and either one of those datatype strings are 'char' or 'varchar'.Now I want to UPDATE table Columns to set all of the columns whose "column" value is in the above query, and set all those DataType values to 'VarChar'. Thus I run that UPDATE query, and the above query should come back empty afterwords in SQL Server I would simply write:
Code: UPDATE Columns SET DataType = 'varchar' WHERE EXISTS ( SELECT 1 FROM ColumnDesc INNER JOIN Columns ON ColumnDesc.COlumn = Columns.Column )
And this would already have been done.But Access doesn't like that syntax. using the designer it created sql like this:
Code: UPDATE Columns INNER JOIN ColumnDesc ON Columns.Column = ColumnDesc.Column SET Columns.DataType = 'varchar'
But that wasn't an "Updateable" query.I have to run this on several patterns and right now I'm completely screwed if I can't get this to work.
My end goal is to have: SELECT DISTINCT Columns.Column FROM Columns return the same # of rows as SELECT DISTINCT Columns.Column, Columns.DataType FROM Columns
for each duplication I will have to do different algorithm, but I can't even get one update query to work so I'm currently frustrated (and ready to reaffirm my belief that Access should have been discontinued 5 versions ago).
Is it possible to create an update query where the Update To field is set to the results of a previous query? I've been playing around with the Design View but I haven't figured out how to do this yet.
I am hoping to do a report all my queries in my Database.
I have managed to use some sql code to list the queries which is the following:
SELECT MSYSOBJECTS.Name FROM MSYSOBJECTS WHERE (((MSYSOBJECTS.Type)=5) AND ((Left([NAME],1))<>"~"));
But i cant seem to get any further i would also like to include the creation date, the description if any, the tables associated with each query, as i know i have a good few queries which maybe duplicates i just want to clean it up.
I currently have the sql below... UPDATE tbl_Node_List INNER JOIN qryUpdate_P1 ON tbl_Node_List.Zip = qryUpdate_P1.[Zip Code] SET tbl_Node_List.[Date Sent] = (SELECT [MinOfAudit Date] FROM qryUpdate_P1), tbl_Node_List.[Date Recv'd] = (SELECT [MaxOfAudit Date] FROM qryUpdate_P1) WHERE (((tbl_Node_List.Zip)="35243"));
but I get an err.msg stating the operation must use an updateable query.
What I am trying to do is update my dates in 'tableA' with the max and min values stored in 'tableB'. I have read some of the posts but still can't quite get it. As always all help is appreciated.
I was working on an update query while joined to another table - and the error I was receiving was the query was not updatable. Er... The table that was being updated sure seemed able to be updated...
Then I wondered if the reason this didn't work was because the other table I was updating from was a query whose records were sum'd and group'd by..I ended up testing the idea by inserting the query's records into a temp table and then did the update to the target table from the temp table... which worked fine.
I have this update query that is triggered by an after update event on a main form. The record being updated are in a continuous subform. It works well except from the last added/modified record. If I save and close the form and then open it again it works for all records but if modify or add a record, the update query will not work for that last modified/added record.
I have tried several things such as save record, use dirty = false for the on exit event of the subform control but nothing works. Here is the procedure:
Code: Private Sub cboPoCurrency_AfterUpdate() On Error GoTo ErrHandler Dim db As Database Dim strSql As String Dim lngID As Long Dim dblRate As Double Set db = CurrentDb
I have a form that displays an updatable subform. The main form has search fields and a search button that when clicked will reset the record source of the subform and then do a refresh. The problem is that after the search the subform stops becomes locked. Here is the code:-
Me!sbfDepartmentSub.Form.RecordSource = MySQL Me.Refresh
I am using an audit trail on my database that works perfectly. My question is, can I run an update query and still log any updates through the audit process?
I suppose the update query is not a necessity, but it would be nice to retain it if possible.
I'm working on a report that highlights employees when they are leaving on travel and returning on travel and my problem is that the report is only run on the weekdays. It highlights all employees that returned yesterday so for instance on Monday's report it only shows people that returned Sunday and not Friday and Saturday.
My first thought was to make an update query convert those days to Sunday in a new column on my table which would then still cause the employee to be highlighted on monday. I made a table with all Fridays and Saturday's in the year and then in the second column is the Sunday Date to update the new field.
I haven't been able to get the update query to work correctly and was wondering if there would be a much easier solution so a person wouldn't continually extend the weekend table manually.
I am trying to update several fields all at once in one single query. Also, I can only use the Design View (No SQL)
The weirdest thing keeps happening though: The more fields I enter to get updated, the less rows get updated.
For example,
When I have only one field that gets updated and I click "run" the window pops up saying I'm about to update 9 rows. It asks me if I'm sure I want to update those records so I say "no".....
Then, I add in another field and click "run" and the window pops up daying I'm about to update 8 rows. When it asks me if I'm sure I want to update those records, again I say "no"......
Then, I add in another field and this time it says 7 rows..... and the trend goes on and on until it says I'm going to update 0 rows.
I have about 15 fields I need to update all at once. I don't get why its not letting me update them simultaneously.