I have a table like so called 'repinfo' (slightly different but relational.)
postcode Rep1 Rep2 Rep3 Rep4
======== ==== ==== ==== ====
AB10 Craig Jack Paul Jemma
HX1 Phil Jezza Gavin Jake
ZS3 Laa Laa Po Tinky W Dipsy
I have an unbound form [Mainform] with a combobox in it [rep_type], with the following types being available:
Builders Merchant
Contractor
Domestic End User
Specifier / Project Consultant
and an unbound text box called [postcode]
I have a subform [mainform_sub] based on a query called 'repinfoextract' that is based on the table [repinfo] above, but has a an overly large nested query in it..
i.e
Representative: IIf(left([forms]![mainform]![rep_type],3)="Bui", [Rep1], IIf(left([forms]![mainform]![rep_type],3)="Con", [Rep2], IIf(left([forms]![mainform]![rep_type],3)="Dom", [Rep3], [Rep4])))
Postcode
criteria = like[forms]![mainform]![postcode]
so in the afterupdate event on the textbox [postcode] that appears on [mainform], it requeries the [mainform]![mainform_sub] and displays who the appropriate rep is based on the customer type choice..
Yes this all works, but I really would like to reduce the amount of iif statements that appear in my queries...
Any takers?
Chyld
It wasn't the fall that was embarrassing, it was realising that I hadn't tied my laces in the first place...
postcode Rep1 Rep2 Rep3 Rep4
======== ==== ==== ==== ====
AB10 Craig Jack Paul Jemma
HX1 Phil Jezza Gavin Jake
ZS3 Laa Laa Po Tinky W Dipsy
I have an unbound form [Mainform] with a combobox in it [rep_type], with the following types being available:
Builders Merchant
Contractor
Domestic End User
Specifier / Project Consultant
and an unbound text box called [postcode]
I have a subform [mainform_sub] based on a query called 'repinfoextract' that is based on the table [repinfo] above, but has a an overly large nested query in it..
i.e
Representative: IIf(left([forms]![mainform]![rep_type],3)="Bui", [Rep1], IIf(left([forms]![mainform]![rep_type],3)="Con", [Rep2], IIf(left([forms]![mainform]![rep_type],3)="Dom", [Rep3], [Rep4])))
Postcode
criteria = like[forms]![mainform]![postcode]
so in the afterupdate event on the textbox [postcode] that appears on [mainform], it requeries the [mainform]![mainform_sub] and displays who the appropriate rep is based on the customer type choice..
Yes this all works, but I really would like to reduce the amount of iif statements that appear in my queries...
Any takers?
Chyld
It wasn't the fall that was embarrassing, it was realising that I hadn't tied my laces in the first place...