Double Criteria for Open Form (1 Viewer)

notrino

Registered User.
Local time
Today, 10:06
Joined
Oct 18, 2018
Messages
26
Hello,

I attached my application,

S1 form showing S1 query values. This form is including double ID (ID1 and ID3) When I push the button, F1 must be open. Same ID1 for F1 is including several ID3 values in the subform. So, I want to ID1 and ID3 criteria at the same time for the main form and subform values. In this way, I can see true records at the same time on the main form. How can I create double criteria? Thanks.
 

Attachments

  • double_criteria.zip
    75.7 KB · Views: 110

Uncle Gizmo

Nifty Access Guy
Staff member
Local time
Today, 09:06
Joined
Jul 9, 2003
Messages
16,278
I suspect your original database was corrupted. I think I might have fixed the corruption but I don't think I fixed your problem let me know!
 

Attachments

  • New Microsoft Access Database.zip
    33.6 KB · Views: 121

notrino

Registered User.
Local time
Today, 10:06
Joined
Oct 18, 2018
Messages
26
Hello Gizmo,

But you misunderstood me. Your solution is including "classic 1 criteria". I want to "2 criteria". F1 form must be open ID1 and ID3 criteria together. Not for only ID1
 

Uncle Gizmo

Nifty Access Guy
Staff member
Local time
Today, 09:06
Joined
Jul 9, 2003
Messages
16,278
Hello Gizmo,

But you misunderstood me.

It's not a case of I misunderstood you, it's a case of I can't understand what the hell you are doing! I still don't, but I have come up with a solution..

See attached for one solution using SQL statements.
 

Attachments

  • New Microsoft Access Database.zip
    40.4 KB · Views: 111
Last edited:

CJ_London

Super Moderator
Staff member
Local time
Today, 09:06
Joined
Feb 19, 2013
Messages
16,604
I think the OP is saying the subform is not related to the main form

e.g. mainform recordsource - tblRailwayStations, subform recordsource - tblFruit


@notrino - look at using the openargs parameter to pass the id for subform as a value, then some code in the main form current event to apply the id value to filter the subform
 

Uncle Gizmo

Nifty Access Guy
Staff member
Local time
Today, 09:06
Joined
Jul 9, 2003
Messages
16,278
I think the OP is saying the subform is not related to the main form

Hi Chris,
Yes, I could see that from the data, but not from the OP's description.

I disconnected the parent/child fields linking the main form & subform, and fed both forms "record sources" as VBA created SQL Statements.

It's not possible to guess the real world use from the example given, which makes it difficult to answer the question.

I don't usually answer questions where the OP doesn't show/explain the real world use, because it indicates to me that there are many unseen "rabbit hole" issues, and/or the OP is trying to solve a typical known, easily solvable problem in their own unorthodox way.

Sent from my SM-G925F using Tapatalk
 

notrino

Registered User.
Local time
Today, 10:06
Joined
Oct 18, 2018
Messages
26
Hello Gizmo,

Yes your last solution is working. But it's a pretty complicated solution. I scared :) Thank you again, see you.
 

Uncle Gizmo

Nifty Access Guy
Staff member
Local time
Today, 09:06
Joined
Jul 9, 2003
Messages
16,278
It's a pretty complicated

It may appear so, but its basically a set of common steps. If you know the steps, then you can apply them throughout your code.

In my experience there's usually 3 ways to do something, sometimes more so I'm surprised that no one has shown a different way of doing it. I'd be very interested to see alternatives.

If you're interested in learning how to code in VBA I'm always looking for students. There would be no charge for this, because I am in the process of learning how to teach, which is a different skill to writing MS Access code. I need willing "guinea pigs" to practice on!


Sent from my SM-G925F using Tapatalk
 

notrino

Registered User.
Local time
Today, 10:06
Joined
Oct 18, 2018
Messages
26
Hello Gizmo,

Thank you. I created myself solution for this application. If I write this codes for
"buton click event" the program running like yours.

Code:
DoCmd.OpenForm "F1", acNormal, , "[ID1]=" & Me.ID1
DoCmd.GoToControl "alt1"
DoCmd.FindRecord Me.ID3
 

notrino

Registered User.
Local time
Today, 10:06
Joined
Oct 18, 2018
Messages
26
. I need willing "guinea pigs" to practice on!


Sent from my SM-G925F using Tapatalk

Of course I'm volunteering. I don't know VBA very well. I am aware that the situation is different, especially in Access applications.
 

Users who are viewing this thread

Top Bottom