473,396 Members | 1,895 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Append Query Using Form textbox functions issue

I created a continuous form in Access2003 based on a query that users review customers and once reviewed clicks on a command button that executes an append query to update a table of the reviewed customer(s) data. The table includes the fields: customer_number, shipto_number [obtained from the associated forms textbox]. I also need to include the date reviewed and the user who performed the review in the append query. The command button is executing the query, however, the query appends 0 records. I have a textbox (USER) on the form that displays the user’s login id from a custom function and date added comes from the Now() function and is not on the form. The append query ask for the value for USER and then updates 0 records. I don't want the users to have to enter USER parameter & just execute the append once button pushed. I’m pretty new to this and this is the last thing I’m struggling with.

Expand|Select|Wrap|Line Numbers
  1. INSERT INTO CleanCusts ( Customer_Number, ShipTo_Number, Date_Added, Added_By )
  2. SELECT InvoicedAddressSelectqry.Cust, InvoicedAddressSelectqry.ShipTo_Number, Now() AS Expr2, [USER] AS Expr1
  3. FROM InvoicedAddressSelectqry
  4. WHERE (((InvoicedAddressSelectqry.Cust)=[Forms]![VerifyCleanedCustomers]![Customer_Number]) AND ((InvoicedAddressSelectqry.ShipTo_Number)=[Forms]![VerifyCleanedCustomers]![ShipTo_Number]) AND (([USER])=[Forms]![VerifyCleanedCustomers]![USER]));
Jan 6 '07 #1
3 4512
pks00
280 Expert 100+
First get your select working first, u do not need column aliases either
Create a new query and run it
the form has to be opened, does the query below work?

Expand|Select|Wrap|Line Numbers
  1. SELECT InvoicedAddressSelectqry.Cust, InvoicedAddressSelectqry.ShipTo_Number, Now(), [USER]
  2. FROM InvoicedAddressSelectqry
  3. WHERE InvoicedAddressSelectqry.Cust=[Forms]![VerifyCleanedCustomers]![Customer_Number]
  4. AND InvoicedAddressSelectqry.ShipTo_Number=[Forms]![VerifyCleanedCustomers]![ShipTo_Number]
  5. AND [USER]=[Forms]![VerifyCleanedCustomers]![USER]

If it doesnt, narrow it down to find your dodgy filter
eg
try this

Expand|Select|Wrap|Line Numbers
  1. SELECT InvoicedAddressSelectqry.Cust, InvoicedAddressSelectqry.ShipTo_Number, Now(), [USER]
  2. FROM InvoicedAddressSelectqry
  3. WHERE InvoicedAddressSelectqry.Cust=[Forms]![VerifyCleanedCustomers]![Customer_Number]
does this work? if so then add the 2nd filter

Expand|Select|Wrap|Line Numbers
  1. SELECT InvoicedAddressSelectqry.Cust, InvoicedAddressSelectqry.ShipTo_Number, Now(), [USER]
  2. FROM InvoicedAddressSelectqry
  3. WHERE InvoicedAddressSelectqry.Cust=[Forms]![VerifyCleanedCustomers]![Customer_Number]
  4. AND InvoicedAddressSelectqry.ShipTo_Number=[Forms]![VerifyCleanedCustomers]![ShipTo_Number]

etc, trial/error
Jan 7 '07 #2
Yes, the original query does return data if I hardcode values for the form variables but does not if I use the form field variables (does not prompt me for values except for USER -
This query does work when I hardcode the substitution variables:
SELECT InvoicedAddressSelectqry.Cust, InvoicedAddressSelectqry.ShipTo_Number, Now() AS Expr1, [USER] AS Expr2
FROM InvoicedAddressSelectqry
WHERE (((InvoicedAddressSelectqry.Cust)="10002832") AND ((InvoicedAddressSelectqry.ShipTo_Number)="000000" ));

However, both queries does ask for the value for the alias [USER] when I run the query.
Jan 8 '07 #3
pks00
280 Expert 100+
Yes, the original query does return data if I hardcode values for the form variables but does not if I use the form field variables (does not prompt me for values except for USER -
This query does work when I hardcode the substitution variables:
SELECT InvoicedAddressSelectqry.Cust, InvoicedAddressSelectqry.ShipTo_Number, Now() AS Expr1, [USER] AS Expr2
FROM InvoicedAddressSelectqry
WHERE (((InvoicedAddressSelectqry.Cust)="10002832") AND ((InvoicedAddressSelectqry.ShipTo_Number)="000000" ));

However, both queries does ask for the value for the alias [USER] when I run the query.
Is USER part of InvoicedAddressSelectqry ?

What Im getting at is u are using [USER] as a column to return, if u want it to return the form value then enter the full paqth

forms!.... as USER
Jan 8 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: John | last post by:
Hi - I am trying to perform a simple append query, with no luck. I have a table (MktPrices) that has the following fields: BondID, PriceDate, Price. The objective is to allow the user to input a...
2
by: Ray Holtz | last post by:
I have a form that shows a single record based on a query criteria. When I click a button it is set to use an append query to copy that record to a separate table, then deletes the record from the...
1
by: Geoff | last post by:
I am running an append query using query by example (but included equivalent SQL code). The query counts the number of bookings and appends this number to bookings to Tbl_Weekly INSERT INTO...
11
by: kabradley | last post by:
Hello Everyone, So, thanks to nico's help I was finally able to 'finish' our companies access database. For the past week or so though,I have been designing forms that contain a subform and an...
2
by: SolomonShavitzMetsFan | last post by:
I am writing for lack of a better word a "mini program" within a form that does a lot of other things and is a bound form for other purposes. The form (frmCustDetail) is bound to another table...
4
by: jcethiopia | last post by:
Hi I'm a new user with Access and I need help with some VBA syntax. I am trying to run an append query using a string SQL statement. Basically, I need to append to "tbl_All" various fields from two...
3
by: bilalkhan | last post by:
Hello I m using MS Acces 2007, I need to create a form through which a user can enter all the parameter values in the form and these values will automatically picked by a query: Here is the...
16
by: iheartvba | last post by:
Hi, I have a simple append query which takes data from a form and appends it into a table. INSERT INTO tblSmsSent ( MobileNumber, ClientName, TimeSent, AppointmentTime, AppointmentDate )...
7
by: Kevin Sims | last post by:
Hopefully the title makes enough sense to get my point across. Using Access 97 here. I am trying build a query which uses a form to select the criteria. It works fine if the source contains...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.