Avatar of Michael Paravicini
Michael Paravicini
Flag for Chile asked on

Join on Expression gives an error

I have a table Pax (PaxId, PaxName) and a query qryPaxRooms (RoomPaxId, PaxName). RoomPaxId in the query is an expression with Nz(ResRooms.PaxId,ResPaxid) AS RoomPaxId. So if a reservation has no rooms yet assigned RoomPaxId will have the PaxId of the reservation otherwise the PaxId of the Room Owner (might be different). Now if I try to join table qryPaxRooms with a different table Invoices (InvID, InvDate, PaxId) on qryPaxRooms.RoomPaxId with Invoices.PaxId I get a type mismatch error. Is it not possible to do a join on expressions? Is there a different solution? Thank you so much for any help! Regards Michael
Microsoft Access

Avatar of undefined
Last Comment
Michael Paravicini

8/22/2022 - Mon
Ryan Chong

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
Gustav Brock

As your IDs probably are numeric, try to force a Long for the ID:

CLng(Nz(ResRooms.PaxId,ResPaxid)) AS RoomPaxId

Open in new window

Or you could attach a database with sample values.
Michael Paravicini

Thank you to both of you for your help. Best regards Michael
I started with Experts Exchange in 2004 and it's been a mainstay of my professional computing life since. It helped me launch a career as a programmer / Oracle data analyst
William Peck