473,395 Members | 1,730 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,395 software developers and data experts.

Max value from one table in one field in another table

Hi

Raw recruit, no VB knowledge but some general programming experience.....

Access 2000 on XP

In form view, I wish to fill the field (ONLY on the record being viewed) with the maximum value from another table. Using query design view I generated the SQL

UPDATE B_Set_OrderNos, [B_PO-Num] SET B_Set_OrderNos.PONum = (DMax("[PONum]","B_PO-Num"));

Running the query with a command button on the form changes this field in ALL the records in the table not just the one in view.

Is there a simple way of dealing with this? What modifications could I make to the SQL and call it with a macroand the command button?

Thanks for any advice.
Oct 2 '08 #1
2 2404
DonRayner
489 Expert 256MB
Hi

Raw recruit, no VB knowledge but some general programming experience.....

Access 2000 on XP

In form view, I wish to fill the field (ONLY on the record being viewed) with the maximum value from another table. Using query design view I generated the SQL

UPDATE B_Set_OrderNos, [B_PO-Num] SET B_Set_OrderNos.PONum = (DMax("[PONum]","B_PO-Num"));

Running the query with a command button on the form changes this field in ALL the records in the table not just the one in view.

Is there a simple way of dealing with this? What modifications could I make to the SQL and call it with a macroand the command button?

Thanks for any advice.
Change your command button"On Click" event to not run the query but to perform the DMax function directly on the field in the form.

Me.myfield = Dmax("[PONum]","B_PO-Num")

change the "myfield to whatever the text box name is on your form
Oct 2 '08 #2
Change your command button"On Click" event to not run the query but to perform the DMax function directly on the field in the form.

Me.myfield = Dmax("[PONum]","B_PO-Num")

change the "myfield to whatever the text box name is on your form
Don

Thanks for your help. In the end I used a macro with SetValue
Oct 3 '08 #3

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

Similar topics

9
by: Deja User | last post by:
This is probably very simple but I can't figure out a way to update one table from another table. Here is an example: ------ TABLEA ------ first_name last_name
1
by: Mike9900 | last post by:
What is the best way to copy DataRow from one table to another table, without copying its structure, which means copying only its data. -- Mike
1
by: thengfen | last post by:
Hi! Im having a problem in transfering a set of records from a table to another table. The scenario is when i select combo box (Course taken such as diploma in IT), then the process will...
5
by: Rex | last post by:
Hi, I want to change a value in one table depending on the value(s) in another table. I am trying to achieve this in a form. to elaborate I have a many-to-many relationship between tables...
1
by: lcourchesne | last post by:
Hi there, This is what I am trying to do: Create a query that will insert a column from Table 2 into Table 1. These two tables are exactly the same in structure, however, there is no unique...
1
by: Sakakini | last post by:
How can I append last entry from one table to another table???
4
by: xoozlez | last post by:
Hi there, How do I insert new records from a dbo table to another table? This is what I have: 1 dbo_company 1 Member (table) I made a query in dbo_company with the criteria I only want to...
3
by: anil2083 | last post by:
How to migrate the comma separated values from one table to another table? suppose we have table i.e XYZ and we have comma separated values in few columns i.e( column_name and values are...
3
by: shubham rastogi | last post by:
hello guys I want to copy or insert records into the previously created table from another table.. For example I have two tables A and B .... I want to copy or insert records from table B into...
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
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.