Group:  Microsoft Access ยป microsoft.public.access.forms
Thread: Make Query Conditional using a Text Field on my Form

DotNetBag
.NET Development Newsgroups

HTVi
TV Discussion Newsgroups

Our Hot Pick: Rising Antivirus 2006 - Certified by TUV & Checkmark! Get 10% discount by entering this coupon code: ONDISCOUNT10
Rising Antivirus 2006

Make Query Conditional using a Text Field on my Form
"cw via AccessMonster.com" <u9891[ at ]uwe> 12.09.2006 22:14:21
I have a Form that prompts for selected information and an OK button that
opens this query:

SELECT tblCPVDSL.ID, tblCPVDSL.DslID, tblCPVDSL.ActiveID, tblCPVDSL.
ResoldVoiceTypeID, tblCPVDSL.Acct, tblCPVDSL.VpVciDlci, tblCPVDSL.
CustomerName, tblCPVDSL.Phone, tblCPVDSL.CKTID, tblCPVDSL.LATA, tblCPVDSL.
InstallDate, tblCPVDSL.Order, tblCPVDSL.CWCPtypeID, tblCPVDSL.dtmAdded,
tblCPVDSL.strModifiedBy, tblCPVDSL.dtmModified, tblCPVDSL.Notes, tblCPVDSL.
SARDate, tblCPVDSL.SARTime, tblCwCpTypes.Type, tblCwCpTypes.Description
FROM tblCPVDSL INNER JOIN tblCwCpTypes ON tblCPVDSL.CWCPtypeID = tblCwCpTypes.
CWCPtypeID
WHERE (((tblCPVDSL.CustomerName) Is Null) AND ((tblCwCpTypes.Type)="VAD"));

I have added a Text Box to my form called LATA and its values will always be
362 or 978.

How do I make my query reference this field on my form and change the WHERE
clause?

1) If the Value = 362 then (tblCwCpTypes.Type)="VAD")
or
2) If the Value = 362 then (tblCwCpTypes.Type)="VFD")

Thanks for any help or ideas,
cw

--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/Forums.aspx/access-forms/200609/1

Re: Make Query Conditional using a Text Field on my Form
pietlinden[ at ]hotmail.com 13.09.2006 05:38:16

[Quoted Text]
> How do I make my query reference this field on my form and change the WHERE
> clause?
>
> 1) If the Value = 362 then (tblCwCpTypes.Type)="VAD")
> or
> 2) If the Value = 362 then (tblCwCpTypes.Type)="VFD")
>
> Thanks for any help or ideas,
> cw
>
Maybe I'm missing something or you mistyped something...

but the way to show one thing (e.g. "VAD") and query for another (362)
is to create a combobox with 2 columns and to hide the one containing
the value. then point your query at the form...

SELECT...
FROM...
WHERE tblCwCPTypes.Type=Forms!MyFormName!cboCwCpType;

Re: Make Query Conditional using a Text Field on my Form
"cw via AccessMonster.com" <u9891[ at ]uwe> 14.09.2006 18:01:00
Thanks for the reply! That did the trick.

I added another Text Box to my Form called TypeValue which will be "VAD" or
"VFD"
using an IIF statement.
Then I added the following code as you mentioned:

WHERE (((tblCPVDSL.CustomerName) Is Null) AND ((tblCwCpTypes.Type)=[Forms]!
[frmCPtypeAndLataRS]![TypeValue]));

Thanks again,
cw

pietlinden[ at ]hotmail.com wrote:
[Quoted Text]
>> How do I make my query reference this field on my form and change the WHERE
>> clause?
>[quoted text clipped - 5 lines]
>> Thanks for any help or ideas,
>> cw
>
>Maybe I'm missing something or you mistyped something...
>
>but the way to show one thing (e.g. "VAD") and query for another (362)
>is to create a combobox with 2 columns and to hide the one containing
>the value. then point your query at the form...
>
>SELECT...
>FROM...
>WHERE tblCwCPTypes.Type=Forms!MyFormName!cboCwCpType;

--
Message posted via http://www.accessmonster.com

Home | Search | Terms | Imprint | Contact
Newsgroups Reader - provided by WiredBox.Net