union query docmd elseif code help

nomax

Registered User.
Local time
Today, 11:05
Joined
Dec 20, 2015
Messages
21
Good morning all, you have been so helpful in the past and I'm stuck again, I don't think this should be this difficult, so it must be me!!

I have a union query that works just fine (thanks to the help received here). It joins 2 forms "cruises" and "bookings". Now my issue is from the datasheet output of this query, I am trying to open either the cruise record or the booking record. I have gotten this to work when they are each on their own datasheet by using

DoCmd.OpenForm "cruise", acNormal, , "[cruiseID]=" & Nz([CruiseID], 0)

or

DoCmd.OpenForm "booking", acNormal, , "[bookingID]=" & Nz([bookingID], 0)

What I am trying to do is be able to click on the confirmation field and open either the cruise form or the booking form. I'm sure I need an else / elseif statement but I'm stumped.

Anyone able to help me figure this one out?

thank you
 
Your terminology is a little confusing. A union query joins two queries not two forms. Is your form now based on the union query?

If so are you trying to open another form for either a booking or a cruise based on that form with the "unioned" data in it? If the answer to that is yes, which field in the form determines if it is a cruise or a booking?
 
In you datasheet output, use the doubleclick event of the cruiseid and copy the open form code from the cruise. Use the doubleclick event of the bookingid and copy your booking form code. Now, when the datasheet is visible, you can open the forms by double clicking on the appropriate column in a selected row

Ben

Verstuurd vanaf mijn SM-G800F met Tapatalk
 
boerbende - the issue is being the datasheet view is based on a union query only the CRUISEID is showing, not the BOOKINGID.

Minty - "your terminology is a little confusing. A union query joins two queries not two forms. Is your form now based on the union query?

If so are you trying to open another form for either a booking or a cruise based on that form with the "unioned" data in it? If the answer to that is yes, which field in the form determines if it is a cruise or a booking? "

Yes, I am trying to open another form based on if it is a cruise or booking - the field that determines that would be TRIPTYPE.
 
Can't you add the booking id in your union query (I have no idea about your datastructure)

Verstuurd vanaf mijn SM-G800F met Tapatalk
 

Users who are viewing this thread

Back
Top Bottom