I have a table that is set as the control source for the report. I invoke the query builder, because the table has foreign keys to lookup tables and I need to link those in so I can display the actual values on the report.
One of my fields is cboParty. This is a field that is a lookup to a table, but the table it looks up is dependant on FKPartyType.
If FKPartyType = Singer (value 2 for the ID), then I need to look up the value of the singer in the table tblSinger. This gets more complicated, because in that table there are a bunch of foreign keys there as well tblSinger has an FKSalutation, txtFirst, txtMiddle, txtLast and FKSuffix.
I would like to bring in the txtSalutation from tblSalutation and do a concatenation of the rest with the txtSuffix from tblSuffix as well.
For the rest of this, in the main control source of this report, if the FKPartyType is any other value than 2 (Singer), then I need to look up the value in the tblPartyRecorder table. This is the same deal where I have an FK to look up from another lookup table.
Any thoughts? I started to build an IIF statement, but got stuck when I realized my dlookup took me to an FK that I need to lookup again.
My problem above is that the FKSalutation is a lookup to the salutation table. Same with FKSuffix and FKRecorder.
Any ideas how to accomplish this, please?
Thanks!
misscrf
It is never too late to become what you could have been ~ George Eliot
One of my fields is cboParty. This is a field that is a lookup to a table, but the table it looks up is dependant on FKPartyType.
If FKPartyType = Singer (value 2 for the ID), then I need to look up the value of the singer in the table tblSinger. This gets more complicated, because in that table there are a bunch of foreign keys there as well tblSinger has an FKSalutation, txtFirst, txtMiddle, txtLast and FKSuffix.
I would like to bring in the txtSalutation from tblSalutation and do a concatenation of the rest with the txtSuffix from tblSuffix as well.
For the rest of this, in the main control source of this report, if the FKPartyType is any other value than 2 (Singer), then I need to look up the value in the tblPartyRecorder table. This is the same deal where I have an FK to look up from another lookup table.
Any thoughts? I started to build an IIF statement, but got stuck when I realized my dlookup took me to an FK that I need to lookup again.
Code:
MyParty: IIf([FKPartyType]=2,DLookUp([FKSalutation]&" "&[txtFirstName] & " " & [txtLastName] &" "&[FKSuffix],"tblSinger",[cboParty]=[PKSingerID]),DLookUp([FKRecorder],"tblPartyRecorder"))
My problem above is that the FKSalutation is a lookup to the salutation table. Same with FKSuffix and FKRecorder.
Any ideas how to accomplish this, please?
Thanks!
misscrf
It is never too late to become what you could have been ~ George Eliot