Update Access Table From A Pass-through Query?

Jun 28, 2012

I want update a table (in Access 2010) based on the results from a pass-through query that pulls data from an old Fox Pro database.

With the following query I push data into my access table (everything works fine):

Code:

INSERT INTO Bolle ( esercizio, numero_documento, ...)
SELECT Bolle_Arca.[esercizio], Bolle_Arca.[numero_documento], Bolle_Arca.[testata_codice], ...
FROM Bolle_Arca
WHERE
Bolle_Arca.[testata_codice] NOT IN (SELECT Bolle.testata_codice FROM Bolle)

When I try to update the same table using the same pass-through query:

Code:
UPDATE Bolle INNER JOIN Bolle_Arca ON Bolle.riga_codice = Bolle_Arca.riga_codice
SET Bolle.esercizio = Bolle_Arca.esercizio
, Bolle.numero_documento = Bolle_Arca.numero_documento, ...
WHERE Bolle.spedito = False
and Bolle.data_invio_mail_spedito is null
and (Bolle.tracking is null or Bolle.tracking = '')
and Bolle.testata_codice = Bolle_Arca.testata_codice;

I get this error: "Operation must use an updatable query"

View Replies


ADVERTISEMENT

Modifying Access Pass Through Query Using Querydefs

Feb 8, 2012

I have a pass through query which I want to add a parameter to the end.

The pass through query is very long and has to crate temporary tables on SQL Server in order to generate the required output.

I do not want to retype or try and paste all of this code into a vba module.

Can I use querydefs or something in the querydefs collection to extract the code into a new query and append my parameter along the way?

A simple way of looking at this could be

querytemplate:-

"set nocount off

Select UWREF
from policy
where UWREF like '"

parameter:- (picked up from a text box on a form)
"ABC123"

additional text to follow:-
"%' set nocount on"

In a nutshell that's all I want to do, but as stated beforehand the real world query has a shed load of other code.

View 1 Replies View Related

How To Pass Table Fields Names From VBA To Query

Aug 15, 2014

I've been developing an Access database to keep track of my company's ongoing projects. There's also a form to browse the history of users actions within the program. It's based on table tbHistory that stores actions and parameters as numbers (for example eventId = 1 is "logged in" and eventId = 2 is "logged out"). I've been using a query to translate those numbers to text with a syntax like:

Code:
IIf([tbEvents].[EventId]=1 Or [tbEvents].[EventId]=2;[tbEvents].[EventDesc];IIf([tbEvents].[EventId]=5 Or [tbEvents].[EventId]=6;...

It worked fine but eventually the expression within expression builder has grown to the level that exceeded allowed limit and I couldn't develop my statement any more.. I decided to develop a vba function that would take eventId as a parameter and would retrieve a string, here it is:

Code:
Public Function translateHistory(eventId As Long) As String
Select Case eventId
Case 1 To 2
translateHistory = ""[tbEvents].[EventDesc]""
Case 6
translateHistory = "[tbEvents].[EventDesc] & "" <b>"" & [tbFormDesc].[FormName] & ""</b>"""

[Code] ....

And in my query I replaced that extremely long expression with just translateHistory([tbHistory].[eventId]). It seems to work, but the result it brings is a pure string with table names and fields - in other words, the query doesn't recognize it should be replaced with appropriate value. Here's the output I get:

Of course I'd like "[tbEvents].[EventDesc]" to be replaced with appropriate value of field "EventDesc" from table "tbEvents" as it used to be.

View 13 Replies View Related

I Am Trying To Run A Pass-through Query In Access With A Variable That A User Enters

Nov 29, 2007

I am trying to run a pass-through query in access with a variable that a user enters in a form. I can't seem to get this to work. Can somebody please help? The variable should be where the 121212 is in the code.

Code


1:FROM doc..eco_summary es
2:INNER JOIN
3:((((mart..DM_Map dmm LEFT JOIN mart..DM_PI dpi ON dmm.Acct_ID = dpi.Acct_ID)
4:INNER JOIN mart..DM_Note dmn ON dmm.Acct_ID = dmn.Acct_ID)
5:INNER JOIN mart..DM_ACCT dma ON dmn.Acct_ID = dma.Acct_ID)
6:LEFT JOIN mart..DM_RE dmr ON dmn.Acct_ID = dmr.Acct_ID) ON es.L_loannum = dmm.Acct_ID
7:INNER JOIN weis..eco_loan_origination elo ON es.L_num = elo.num
8:where es.L_num = 121212

View 1 Replies View Related

Queries :: Pass Table Names To Delete Query

Aug 27, 2014

I use the following code to delete from a table all records except those meeting the WHERE criteria:

Code:
DELETE tblABC.*, tblABC.SubjectID
FROM tblABC
WHERE (((tblABC.SubjectID)<>99 And (tblABC.SubjectID)<>432));

I'd like to run this exact same query, but on many other tables, all of which are stored in tblTablesToClean (TableID, TableName).

Any good way to have Access loop through the list of tables in tblTablesToClean, each time passing the name of the table into the DELETE code and running the code, until all tables have been processed?

View 5 Replies View Related

Converting Access Query To Pass-Through Query

Dec 23, 2005

Can anyone help? I have a query that queries against 11 linked views against an SQL Server backend.

The query is running dog slow, so I want to convert it to a pass-through query so that the processing is done server side rather than Access having to drag thousands of records across the network, but don't know where to start.

The problem is that I need to convert the Access SQL to a version of SQL that SQL Server understands.

Is there a tool I can use that does this automatically (keeping my fingers crossed here)? If not then does anyone know where I can find out how to do this?

View 2 Replies View Related

Queries :: Create Update Query To Budget Table Using Access Design View?

Feb 17, 2015

trying to create an update query to Budget table using the Access Design View:

Field: PctSls (in tblBudget) Update to: [Expense] / [Sales]. The update query always returns 0. However, if I create a Select query using the same calculation, the correct results is displayed. PctSls is defined in the Budget table.

I haven't worked with Access (2003) for several years but this seems too simple to be causing me such frustration. (Was only a casual user even then).

View 6 Replies View Related

Queries :: Pass Through SQL To Update SQL Field

Aug 26, 2014

I have an SQL table that uses bigint on the primary key field. When I lilnk this table into Access 2010, this table is not even visible because bigint isn't recognized by Access.I have a field on this SQL table that I need to update and I was looking at using a Pass Through query in Access. I have a query in Access that creates a list of records that I need to update.

View 3 Replies View Related

Procedure Works Great First Pass, But Not The Second Pass

Jul 15, 2005

Good afternoon, I have a form with a subform and in the first txtbox of the subform in the GotFocus event I have a little procedure which checks the txtboxs on the parent to make sure that there is data in all four of the txtboxes. This works great the first time and it pops up a msgbox and it even setsfocus on the txtbox with no data in it, but if I tab into the subform a second time and there still is no data in one of the txtboxs on the parent form, nothing happens, no message and no setting focus on the txtbox with no data in it. Does anyone know of a way to get this procedure to re-set everytime a user tries to enter the subform? Thank you in advance to anyone offering and ideas and suggestions.

View 8 Replies View Related

Forms :: Update Data From One Table To Another Table Using Form - Access 2010

Dec 16, 2013

How to update data from one table to another table using form.

I have data coming from design team in Database 1 and using form i want search data and assign the job to a person and store it in the database with his name. I have to do this because database from design team is read only.

View 1 Replies View Related

Modules & VBA :: Update Access Table From SQL Server Table Source

Jun 17, 2013

I have created a code below to test whether I can run a query and retrieve a data from an SQL server table. And so far I can return the result using a messagebox. but somehow I just don't know how to use this connection to update the table inside this access file. Basically I want to use this as a front end file. then when the form is open it will automatically update the table inside this access file and load the data to the combo box as a list.

Code:

Option Compare Database
Sub LocalServerConn_Test()
Set conn = New adodb.Connection
Set rst = New adodb.Recordset

[code]....

View 4 Replies View Related

Update Query Won't Update In Access 97

Feb 10, 2008

I am trying to remove random characters from a field. The field [assycode] contains a string similar to say, FGEJBF1 or ABFGYRUKC I want to remove any occurrence of "F1" normally at the end of the string but not always at the end. I used: Like "*f1*" to find the correct records, that worked fine, I then used [Assycode]-" f1" in the update to box, It wants to update 146 records I click ok then it says It couldn't due to a type conversion error. Just messing around I tried adding "F1" to these records using [Assycode]+" f1" and it worked fine. Can anyone point me in the right direction?

Thanks in advance

Wayne

View 5 Replies View Related

Pass Arguments To Access

Sep 1, 2005

Hello,

I want to be able to pass arguments to an access file on start up. I want to be able to grab this value and then perform an action based on this.

Background:
The program will send an email with details for a change request, the recipient will then need to click on a link to accept or reject this change. So I want them to be able to click the link which will trigger the program to save accept or reject.

Regards,
Todd

View 3 Replies View Related

How Can I Pass Data From Primary Table To Another Table?

Apr 13, 2008

ok , i have a primary table that have a field of "job", then i create another table that have a field of "job" too , then how can i do this task?

Whatever i type a data into the primary table("Job" field) i want it to duplicate the data into the another table("Job" field) . is it possible to do this? can anyone guild me to do ?

View 1 Replies View Related

How To Pass Data From One Table To The Next?

Jul 6, 2006

Hi everyone! :)

First off I have to say I'm not an Access Guru by any means. I can make a very very basic database in access but beyond that I'm toast.

So I've just started working on a project that is in it's second year. The project was started last year by a student and she created, what seems to me, to be an adequate small database for the project. I've noticed however that when entering data, some of it has to be entered twice. This has been made easier through the use of the look up tab in the field definition (?). However, I worked with a student before who created a database where the primary key value of a "parent?" table was automatically forwarded to the corresponding field in the "child?" table.

So here's a hypothetical, let's say you have a restaurant, and one restaurant can have ummmm many tables, and then one table can have manyyyy chairs! There's a unique restaurant id created in the restaurant table, which is say needed with a table number to create a unique table id in the table table, which is in turn needed with a chair number to create a unique chair id in the chair table? So you basically have 3 tables where unique ids are being created. So then lets say you have a chair description table that has fields in it to contain all the ids made previously, as well as some of the information entered to create the unique fields (i.e. table number, chair number). My question is..if I've already entered this data in previous parent tables then why is it that the data doesn't carry forward to these fields? Is it because these fields are not primary key fields in this last table? If that's the case then is there a way to set this up? Right now there's a select statement used in the look up reference option that has something to the effect "select table.table_name from table;". So I know what it's doing and when I enter data I can select the table id I need. It just seems a bit redundant data entry wise to enter yet again values I entered the table before, or values that were generated for me in the table before.

Is there a way to have these fields automatically populate with the corresponding data that was entered to get to this table? Does it involve modifying the select statement to involve a where clause (terminology? clause?). Any ideas would be very much appreciated! Thanks.

Sue

View 5 Replies View Related

Queries :: Update Query (table To Table) Not Updating All Records

Nov 26, 2013

I'm using an UPDATE query to update records in one table (tblMain) from another table (tblTemp)

Here is my SQL :

Quote:

UPDATE [tblMain]
INNER JOIN [tblTemp] ON [tblMain].[MainField1] = [tblTemp].[TempField1]
SET [tblMain].[MainField2] = [tblTemp].[TempField2];

I only want to update the records in tblMain which have a corresponding record in tblTemp (linked by MainField1 / TempField1)

If any record doesn't appear in tblTemp, I want tblMain to retain the existing value for that record.

However, it appears that in such situations, the record in tblMain has it's MainField2 value set to null / ZLS.

I've tried using LEFT JOIN and RIGHT JOIN and also tried WHERE clauses but the result is the same every time.

View 3 Replies View Related

Trying To Use A Formula In Access To Update A Table

Jan 22, 2005

I have a form that has 3 fields each representing a different table. I want the sum of 2 of the fields to update the third field. The third table has an existing value in it, but I need it to change when the formula is executed. I have a formula embedded in the form and can make the formula work, but it doesn't update my table. How can I make it do this? :confused:

View 1 Replies View Related

Using Access Form Fields In Pass-through Queries To MYSQL

May 9, 2005

I don't know if this is thebest place for this, but here goes....

I have an Access FE using MYSQL 4.1 BE. I have several forms and PassThrough queries (using MYSQL syntax not supported or available in Access).

How can I use form field values to use as criteria for these queries?

FOr example, in a pure Access database. I may have a form 'Employees' with a text box 'EmployeeName'. THen have a query....

SELECT * FROM tblEMployees WHERE EmployeeName = [Forms]![Employees]![EmployeeName]

If I were to add this variable to my pass-through queries, it errors. How can I do the same thing, passing my form fileds to an Access Query? I am trying to do this right in the SQL view of the queries, not in VBA or Macros or anything.

Thanks,
Scott

View 2 Replies View Related

Pass-Through Query Help

Jul 13, 2007

I'm trying to create a PTQ and just cant seem to find the source table.

The name of the source table is PRM1_ORG_MTRX3_N

If I write my query like this, I get an error code that states username.PRM1_ORG_MTRX3_N is an undefined name. It adds my userid to the beginning of the table name.

SELECT
T128.AS_OF_DATE,
T128.LEVEL8,
T128.LEVEL8_ORG_NAME,
T128.LEVEL9,
T128.LEVEL9_ORG_NAME

FROM
PRM1_ORG_MTRX3_N as T128

WHERE
T128.AS_OF_DATE like '1/1/2007'

Then I rewrote the query like this, and I got and error code that said PRM1.ORG_MTRX3_N is an undefined name. Does anyone know what else I can try here to get this query going? Thanks


SELECT
T128.AS_OF_DATE,
T128.LEVEL8,
T128.LEVEL8_ORG_NAME,
T128.LEVEL9,
T128.LEVEL9_ORG_NAME

FROM
PRM1.ORG_MTRX3_N as T128

WHERE
T128.AS_OF_DATE like '1/1/2007'

View 2 Replies View Related

Pass Through Query

Jun 30, 2006

Can you do a pass through Query to a pivot table when your query has parameters? I'm reading like you can't, but nothing has been said concretely yet. When I do it, it gives me an error "Trouble Obtaining Data" when I try and set the layout.

View 1 Replies View Related

Create New Record & Pass Autonumber To Separate Table

Mar 10, 2008

I have a form, frmSub, that contains the combo box comProducts. I also have two tables, Products and PurchaseDetail. Both tables have the field ProductID.

I want comProducts to create a new record in the Products table, using the input in a field called Product and then to use the value of ProductID to create a new record in the PurchaseDetail table. Ie, so the PurchaseDetail table has a record that links to another record in the Products table via the feild ProductID.

I hope I was semi-clear.

View 4 Replies View Related

Forms :: Possible To Make Pass Through Table Editable After Filter It?

Jan 8, 2015

So what I have created is a form with 4 combo boxes which filters a subform with a click button by running a sql query.It was working great yesterday but then when I made the subform a pass through query it seems to no longer run (or just runs so slow it takes a large amount of time to query). To get a better sense of what I'm talking about I basically have a button and inside of the button it takes this query template:

SQL = "SELECT * FROM queryname WHERE 1=1"

concats with if statements to the end of the Where clause with the values in the combo box and then sets

subFormName.Form.RecordSource = SQL

how I can get this table to query...Also, for my second question, is it possible to make this pass through table editable after I filter it?

View 1 Replies View Related

Modules & VBA :: Pass Data Field Value To HTML Table

Feb 16, 2015

I have code that will create an email and prepare it for sending.It will create a table inside the email and fill it in with some text and underscore characters to be replaced by data from the database. So far the data has to be done manually. I would like to know if it is possible to use the values from some fields inside the select record in the current form. So, if Me.Status would be "New" it should pass this to the table in the email.So far I have the below code:

Code:
Private Sub Command280_Click() 'send email with table
Dim objItem As Object
Dim oMail As Outlook.MailItem
Set oMail = objItem
Dim oApp As Object

[code]...

View 5 Replies View Related

How To Count And Sum Registries From A Table And Pass It To A Control In Form

Jan 11, 2015

In Access 2013 I have a table to registry the presents in a condominium meeting.

Table Name: tbEntities

Fields:

tbEntId...tbPresent (yes / no)..........tbVotes
1.........yes...........................5
2.........no.............................3
3.........yes............................4
4.........no.............................6

I want to put in a form (like a navigation/menu form, with no souce data):

1. a control that count how many are present (= yes)Ex: Appearances 22. a control that sum the votes of those presentEx: 9 Votes

View 6 Replies View Related

How To Trigger Access Table Update Event

Jan 5, 2005

Hi,

I use access database for a website. I would like to run a trigger in a specific table when updating a record.

Is it possible to create table level triggers in Access at all, if it is, pls. give me short direction. (as far as I know there are lot of events, but this events occur only in native access application only, and can not be handled outside of access, am I right?)

thanks a lot

solesz

View 1 Replies View Related

Modules & VBA :: Update Access Table Through Excel

Jul 26, 2013

I have an access database that is used to store records of requests for for items. Example, ID, WhoRequested, CustomerName, Date, address, phone, WhatRequested, amt. I take this data and export it to an excel spreadsheet and send to another area for processing.

I then get the sheet back with the orderdate, ordernumber, and shippingnumber. I need to update the original table with this new information. it is not bad when there is only a few, but Ihave had 100 or so lately, and updating each record manually is time consuming.

View 1 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved