473,405 Members | 2,176 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,405 software developers and data experts.

How to control which records are updated

102 64KB
[Z{Mod Edit: Removed duplicated information between merged posts}]


Hello friends

I have a form with Update buttons. When it is pressed, a query02 runs.

Source table: TEMPAY
Source field: QNO

Destination Table: PAYMENT125
Destination field: INSTNO

Query should check before Add record INSTNO <= QNO
if it is not <= query should not run

image of query is attached



Here is the SQL for friends to correct it.

Expand|Select|Wrap|Line Numbers
  1. INSERT INTO [PAYMENT 125] 
  2.    ( CODE125, INSTNO, [DATE], AMOUNT )
  3. SELECT TEMPAY.CODE125, TEMPAY.QNO, 
  4.    TEMPAY.QDATE, TEMPAY.QAMOUNT
  5. FROM TEMPAY 
  6.    INNER JOIN [PAYMENT 125] 
  7.    ON 
  8.       TEMPAY.CODE125 = [PAYMENT 125].CODE125
  9. GROUP BY TEMPAY.CODE125, TEMPAY.QNO, 
  10.    TEMPAY.QDATE, TEMPAY.QAMOUNT
  11. HAVING (((TEMPAY.CODE125) Is Not Null)
  12.     AND ((TEMPAY.QNO) Is Not Null) 
  13.    AND ((TEMPAY.QDATE) Is Not Null) 
  14.    AND ((TEMPAY.QAMOUNT) Is Not Null));
My database is also attached in zip format. QUERY02 needs to be correction.
Attached Images
File Type: jpg append query.jpg (32.0 KB, 493 views)
Attached Files
File Type: zip TESTING.zip (1.64 MB, 53 views)
Feb 16 '13 #1
5 1723
NeoPa
32,556 Expert Mod 16PB
This is a much better attempt at asking a question. Nevertheless, a picture of your query is no help. Mainly because it's too small even to see what's in it, but also because a picture of a query tells us very little. Please copy and paste the SQL of your query, which you can see if you view the query in SQL View. I suspect we can do something with that.
Feb 16 '13 #2
zmbd
5,501 Expert Mod 4TB
irsmalik:

If you will take a careful look at your question... you have the answer there... add INSTNO <= QNO to your conditions.

Some things to point out:
- First, you should know that most of us will not open an attachment that is not requested.
It is always better to try and provide the information within the text of the post.

- Second, after some 20 posts someone should have pointed out the following:
-- Bytes is not a code nor homework service. Please read the FAQ and posting guidelines before re-posting your question.
>> Before Posting (VBA or SQL) Code.
>> How to ask "good" questions -- READ BEFORE SUBMITTING A QUESTION!.
>> POSTING_GUIDELINES: Please Read Carefully Before Posting to a Forum.
Feb 16 '13 #3
zmbd
5,501 Expert Mod 4TB
Good grief... I just noted
You have a field named "Date"
That is a reserved/key-word. Using reserved/key-words as a field name is very bad idea as it can and will cause you issues with VBA, Macro, and SQL. You really should avoid: RESERVED KEYWORDS BY LANGUAGE
Feb 16 '13 #4
zmbd
5,501 Expert Mod 4TB
irsmalik:
I didn't catch that you had double posted your question.
Please do not do that in the future.

In this case, I've merged the two threads and the duplicated posts because the second post thread appeared to be an honest attempt to comply with Neopa's request for the SQL (post #2) and I like to give the benefit-of-the-doubt to the poster when possible.

In future, if you are requested to provide code/sql/script to clarify a question, please do so within the original thread.

Please read the links I provided at the bottom of post #3. You will be expected to follow the guidelines contained therein for all future posts.
Feb 17 '13 #5
NeoPa
32,556 Expert Mod 16PB
It's a little clearer with the SQL, but you also need to explain what it is you want (much better than you did in the first post) and what problem you are actually getting.

Normally we can get some clues from the SQL, but this seems to be a mix of a number of ideas, none of which is done properly. Trying to guess what you want is therefore particularly difficult.
Feb 17 '13 #6

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: JMCN | last post by:
hi i need some advice on whether if it would be better to use an append query or an update query. here is the situation, i have linked another database table to my current database. then i...
2
by: JMCN | last post by:
hi i have a general question regarding append queries in access 97. each week i need to update my table(tblonlinereg) with new or modified records. firstly, i import the text file into my...
1
by: David Barger | last post by:
Greetings, It appears that an Append Query I run in Access XP is randomly failing to append a field. I have payroll data being entered into a payroll database. This data is exported daily to...
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...
4
by: robboll | last post by:
When I try to use an append query from an oracle link it takes forever. I am exploring the idea of doing an append action using a pass-through query. If I have an Oracle ODBC connection to...
4
by: pmacdiddie | last post by:
I have an append query that needs to run every time a line item is added to a subform. The append writes to a table that is the source for a pull down box. Problem is that it takes 5 seconds to...
1
by: hr833 | last post by:
hi.. i'm using a append query to filter some new records that must be updated in the lookup table. In this lookup table it consist of the part number and the type of the product. the part number...
4
by: Scott12345 | last post by:
Hi, here is my situation, I have a DB that tracks machine downtime (30 machines) per day. Several users will update this through the day. I created an append query that creates 30 dummy values and...
4
by: Adam Tippelt | last post by:
Situation: When a user 'confirms' that they want to save the information they've inputted, I need to append the database records from a temporary table to a different table. Problem: The...
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?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

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.