T
Tal
I am utterly confused. I only speak rudimentary VBA, so please be gentle, but
here it goes.
For the purposes of this discussion, I have 3 tables:
tblDonations: All the information about a donation (lots o' lookups)
tblClients: Donor and Recipients information (one to many rel with
tblDonorAddresses)
tblNameLookup: keyNameLookup with values 1 to 7
I am creating an intake form for donations, so the recordsource is
tblDonations
In this table I have a field "keyDonor" that looks up the "keyClient" field
in the tblClients.
I also have a "keyReceiptTo" field that looks up values in the tblNameLookup.
I need to write the code that will return something like the following in a
cboReceiptTo combo box on my form where the Control Source is the lookup
field in tblDonations to tblNameLookup where
If keyNameLookup = 1 then return [tblClients].[FirstName] & " " &
[tblClients].[LastName]
If keyNameLookup = 2 then return [tblClients].[SpouseFirstName] & " " &
[tblClients].[LastName]
etc...
Where [tblClients].[keyClient] = Me.keyDonor (which derives it's value from
a combo box that lists all Clients.
I was told to use the Switch Function but I have absolutely no idea how to
do so.
Help desperately needed and much appreciated.
Many thanks,
Talia
here it goes.
For the purposes of this discussion, I have 3 tables:
tblDonations: All the information about a donation (lots o' lookups)
tblClients: Donor and Recipients information (one to many rel with
tblDonorAddresses)
tblNameLookup: keyNameLookup with values 1 to 7
I am creating an intake form for donations, so the recordsource is
tblDonations
In this table I have a field "keyDonor" that looks up the "keyClient" field
in the tblClients.
I also have a "keyReceiptTo" field that looks up values in the tblNameLookup.
I need to write the code that will return something like the following in a
cboReceiptTo combo box on my form where the Control Source is the lookup
field in tblDonations to tblNameLookup where
If keyNameLookup = 1 then return [tblClients].[FirstName] & " " &
[tblClients].[LastName]
If keyNameLookup = 2 then return [tblClients].[SpouseFirstName] & " " &
[tblClients].[LastName]
etc...
Where [tblClients].[keyClient] = Me.keyDonor (which derives it's value from
a combo box that lists all Clients.
I was told to use the Switch Function but I have absolutely no idea how to
do so.
Help desperately needed and much appreciated.
Many thanks,
Talia