spartansFC
Registered User.
- Local time
- Today, 07:59
- Joined
- Aug 26, 2007
- Messages
- 13
Hi
i'm having problems with a query, as it seems to be returning the autonumber value on a query.
Basically i have 2 tables.
tbl Referrer, which has fieldnames:
referrer_id (autonumber)
referrer_maincontactname (text)
referrer_mainbusiness (number)
referrer_secondarycontactname (text)
referrer_secondarybusiness (number)
referrer_isthismaincontact (yes/no)
and also
tbl business name which has fieldnames:
businessname_id (autonumber)
businessname (text)
the referrer form has a check box on, and i basically want to run the query to report via a virtual name, if the referrer is the main or secondary business.
the referrer_main and referrer_secondary are both combo boxes, and all link to tbl business name, i set them up that way as i wanted to limit the number of options the user has, although i have set up a NotInList option, so users can add new business names.
so i've set up the query:
referrer_maincontactname,
referrer_mainbusiness,
referrer_secondarycontactname
referrer_secondarybusiness
referrer_isthismaincontact (yes/no)
i then set up a virtual name and a IIF statement:
leadname: IIf([referrer_isthismaincontact]=Yes,[referrer_maincontactname],[referrer_secondarycontactname])
this query works great, and returns the correct contactname, but then when i do the same thing for the business name query:
leadrole: IIf([referrer_isthismaincontact]=Yes,[referrer_mainbusiness],[referrer_secondarybusiness])
the query returns a 1 or a 2, instead of the business name, i'm sure its because the business name is on a different table, i've checked the bound and column settings on the tbl Business name, i've even changed them but nothing, the query does work to a point, in that it does show either a 1 or a 2, but i'm not sure how to make it sure the business name, and not the autonumber.
i haven't linked these 2 tables in a relationship, i just use a Table/Query lookup function, so i'm not sure if it's that, but it can't be as the query nearly works.
any ideas
thanks
Mikie
i'm having problems with a query, as it seems to be returning the autonumber value on a query.
Basically i have 2 tables.
tbl Referrer, which has fieldnames:
referrer_id (autonumber)
referrer_maincontactname (text)
referrer_mainbusiness (number)
referrer_secondarycontactname (text)
referrer_secondarybusiness (number)
referrer_isthismaincontact (yes/no)
and also
tbl business name which has fieldnames:
businessname_id (autonumber)
businessname (text)
the referrer form has a check box on, and i basically want to run the query to report via a virtual name, if the referrer is the main or secondary business.
the referrer_main and referrer_secondary are both combo boxes, and all link to tbl business name, i set them up that way as i wanted to limit the number of options the user has, although i have set up a NotInList option, so users can add new business names.
so i've set up the query:
referrer_maincontactname,
referrer_mainbusiness,
referrer_secondarycontactname
referrer_secondarybusiness
referrer_isthismaincontact (yes/no)
i then set up a virtual name and a IIF statement:
leadname: IIf([referrer_isthismaincontact]=Yes,[referrer_maincontactname],[referrer_secondarycontactname])
this query works great, and returns the correct contactname, but then when i do the same thing for the business name query:
leadrole: IIf([referrer_isthismaincontact]=Yes,[referrer_mainbusiness],[referrer_secondarybusiness])
the query returns a 1 or a 2, instead of the business name, i'm sure its because the business name is on a different table, i've checked the bound and column settings on the tbl Business name, i've even changed them but nothing, the query does work to a point, in that it does show either a 1 or a 2, but i'm not sure how to make it sure the business name, and not the autonumber.
i haven't linked these 2 tables in a relationship, i just use a Table/Query lookup function, so i'm not sure if it's that, but it can't be as the query nearly works.
any ideas
thanks
Mikie