Open a specific record with multiple where conditions (1 Viewer)

tere0112

New member
Local time
Today, 17:13
Joined
May 19, 2021
Messages
1
Hi everyone,


I have 3 tables that represent 3 levels.

1. Ordernumber and other general info
2. Ordernumber, article, price and other info related to product
3. Ordernumber, article, color, s,m,L, etc. and other details


I have made a parent and child form based on queries of table 1 and 2. On this parent/child form I am trying to add a button next to each record of the child form( from table 2) saying colors/sizes, which opens table 3's form but only showing the records based on ordernumber and article of table 2 form. And of course, when i add new records throught that form, it automatically stores it under a
Specific article and order

I am not sure if i explained my self well.

I found this vba code online, and reworded it using my field names but it doesnt work.

DoCmd.OpenForm FormName:="frmOrdineDetragli", _
WhereCondition:="ART= """ & Me.ART & """ " & _
"AND Ordine = """ & Me.Ordine & """""

When i had only condition say ART, i can easily use the Macro builder. But it shows all records that contain that ART(article), regardless of order number.

Thanks !!!
 

plog

Banishment Pending
Local time
Today, 10:13
Joined
May 11, 2011
Messages
11,638
I'd really like to see your tables because what you've explained doesn't seem normalized:


Further and more addressed to your issue--you really should only need to use an ID to open a form to records related to a higher level table. You didn't post any ID field in your table summary, so that's another reason I'd like to see your tables. I fear you're building queries and forms on a poor table structure.
 

conception_native_0123

Well-known member
Local time
Today, 10:13
Joined
Mar 13, 2021
Messages
1,834
I am not sure if i explained my self well.

not really, sorry. it would probably be best to upload the entire database file to this thread. plog would probably give you a rundown of how to re-architect.

I have 3 tables that represent 3 levels.

1. Ordernumber and other general info
2. Ordernumber, article, price and other info related to product
3. Ordernumber, article, color, s,m,L, etc. and other details

that does not look right at all. what business are you in? an order number, in general, should only be found in one table. everything in the "other info related to product..." should be in table 2 as ''x'' number of child records to the order number.
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 23:13
Joined
May 7, 2009
Messages
19,233
maybe a little sample will help you understand.
 

Attachments

  • Ordernumber.accdb
    2 MB · Views: 172

Users who are viewing this thread

Top Bottom