I have a table "ordering" and a table "inventory" which are related by the field "chemical." On "ordering" the information doesn't change. It is just information about price, company, etc. On inventory when an order is made it will save the date, how many we currently have in stock, etc. I need some help with two things.
1. On one form they choose a chemical from a combo box and I want the information in "ordering" to display along with a new record in "inventory" for entering this information.
2. On another form they again choose a chemical from a combo box, but this time I want the date and such from the most recent order to show.
Any help is greatly appreciated. Thanks.
Perhaps, after the main form has opened, on the OnCurrent Event, you can use VBA to move the subform to a new record. This would ensure that the table underneath the subform is still pointing to the proper chemical, and it would be nearly invisible to the user....
7 1901
1) In your inventory form, you can either set the record source to a query where you join the table to ordering and return the fields you want. But that may make your query unupdateable. If it does, you can bind the control source of some controls to a DLookup of the Ordering table.
2) Make the control source of the form an aggregate query that returns the max order date by chemical.
Looking only at the first situation now. I have the form's record source set to the query with both tables connected by the field chemical. The query is updateable from the form. I want the fields in the query that come from the inventory table to be at a new record. Right now users would have to scroll through all of the old records with the arrows at the bottom.
Basically I guess my question is as follows (only worded better, I think). The table orders only has one record per chemical. They table inventory has multiple records for each chemical (all of the past orders). They are linked in a query by the chemical field and this query is the record source for the form. I want to know if it is possible automatically have the query pull up a new record for the inventory table from the query. I also, on another form, want to do the same but to view only the most recent order.
For situation 1), you could set the form's Data Entry property set to "Yes" and this would automatically take the user to a new record.
For situation 2) Rabbit has a good idea, but I'm not sure the recordset would be updateable. If you needed it to be updateable, have a query, filtered by Chemical, sorted by date, newest to oldest, and just choose the first record. -
SELECT TOP 1 ....{the rest of your query}
-
1. Data entry turned to yes does not do what I need. It is set to yes but I need a new record on only one of the tables in the query. I apologize, I am having a hard time explaining this. I need to view the information already in the the ordering table for the chemical selected and the the other table should have a new record where quantity and date can be filled out.
2. I think this will work. I do not need the query to be updateable for this part. Thanks.
I have the form's record source set to the query with both tables connected by the field chemical
It is rarely a good idea to combine two tables into a single form for updating.
First create a form bound to Ordering, showing all the details you need, and in its header place the combobox you want to use for selecting the chemical.
Use the afterupdate event of the combobox to navigate the form to the correct record. How this is done depends a bit on how the primary key of your ordering table is setup. (More info required)
Create a Continues form bound to Inventory, and add this as a subform into the previously mentioned form, and set the link properties to use the primary/Foreign key (you called it Chemical I believe)
From what you have described I believe a form/subform approach would be the best way to go.
Perhaps, after the main form has opened, on the OnCurrent Event, you can use VBA to move the subform to a new record. This would ensure that the table underneath the subform is still pointing to the proper chemical, and it would be nearly invisible to the user....
A subform works great. I just had to rearrange some other things. Thanks.
Sign in to post your reply or Sign up for a free account.
Similar topics
by: leegold2 |
last post by:
Not sure if I should post in php or sql,
$query = "SELECT page.*, url_pages.* FROM `page` LEFT JOIN `keywords`
USING(`page_id`) LEFT JOIN URL_PAGES USING (`page_id`) WHERE...
|
by: DBNovice |
last post by:
I have a database that keeps records on the issue and failure of an item.
Currently, the database is poorly desisned; therefore I'm performing queries
to break the data into normalized tables and...
|
by: Dave Sisk |
last post by:
Hi Folks:
I'm a little new to SQLServer, so please pardon my ignorance!
I've found the INFORMATION_SCHEMA views for TABLES, COLUMNS, and
TABLE_CONSTRAINTS. I'm looking for the views that will...
|
by: Yisroel Markov |
last post by:
Greetings,
I have a query that looks like this in SQL:
SELECT tblCommit093004.Currency, First(tblCommit093004.Commitment) AS
FirstOfCommitment, First(tblCommit093004.Drawn) AS FirstOfDrawn,...
|
by: gbradford3 |
last post by:
I can pull up an MS Access database, link DB2 tables to it (using a
System DSN) and create queries that return differences between a MS
Access table and a DB2 table. I am able to query both the MS...
|
by: empiresolutions |
last post by:
Hello Fellow Programmers,
I have an issue with a very large PHP page that calls over 20 different MySql Statements. This page is loading somewhat slow and i want to speed things up. I have looked...
|
by: =?Utf-8?B?Q2hyaXM=?= |
last post by:
How can I run this query against a table in my Access database? I don't know
hwo to use it in C#. In VB I would use .Recordset = "some sql statement". How
do I do this in C#?
//I get a vlaue...
|
by: mrcerny |
last post by:
I am fairly new to Access so this might be pretty easy. I have a calculated field in a query. I would like to link another table to this query through this calculated field. Can anyone help?
|
by: akirekab |
last post by:
I am tired, as I have done this or similar things many times, I am not seeing the problem here.
I will run a query producing the following SQL
SELECT tblInterviewRecord.FaceToFaceReasonID,...
|
by: limperger |
last post by:
Hello everyone!
My question is simple: is it possible to update a 2 tables-based query (that is, with fields coming from 2 tables)??. The two tables are joined in a one-to-one join type. The...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
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...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
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...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
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,...
|
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: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
| |