using access with outlook custom form

D

dh

I am using an access database with a custom outlook form.
I have a combo box that I am filtering to fill another combo box.
Originally, I
had a table with that had two field and the string that I used to filter was
as follows:
strSQL = "SELECT [DienCodes] " & "from Codes " & "WHERE [CodeID] =" & CatID
& " " & "ORDER BY [DienCodes];"

I want to add a nother filer item (WHERE) and have tried the following mod.
to the above string::

strSQL = "SELECT [DienCodes] " & "from Codes " & "WHERE [CodeID] =" & CatID
& " " & "AND" & " " & "[CountryCode] =" & CountryCode & " " & "ORDER BY
[DienCodes];"


and this variation:

strSQL = "SELECT [DienCodes] " & "from Codes " & "WHERE [CodeID] =" & CatID
& " " & "AND" & " " & "WHERE[CountryCode] =" & CountryCode & " " & "ORDER BY
[DienCodes];"

Can you tell me if I am doing something wrong because the above string will
not filter by the twotable field identifiers, CodeID and CountryCode.

Any assistance is greatly appreciated!

DH
 
N

Naresh Nichani MVP

Hi:

In second variation this seems to be a obvious error --
strSQL = "SELECT [DienCodes] " & "from Codes " & "WHERE [CodeID] =" & CatID
& " " & "AND" & " " & "WHERE[CountryCode] =" & CountryCode & " " & "ORDER BY
[DienCodes];"

You need a space between WHERE and [CountryCode].


Regards,

Naresh Nichani
Microsoft Access MVP
 
D

dh

Thanks, I will give it a try!
DH
Naresh Nichani MVP said:
Hi:

In second variation this seems to be a obvious error --
strSQL = "SELECT [DienCodes] " & "from Codes " & "WHERE [CodeID] =" & CatID
& " " & "AND" & " " & "WHERE[CountryCode] =" & CountryCode & " " & "ORDER BY
[DienCodes];"

You need a space between WHERE and [CountryCode].


Regards,

Naresh Nichani
Microsoft Access MVP

dh said:
I am using an access database with a custom outlook form.
I have a combo box that I am filtering to fill another combo box.
Originally, I
had a table with that had two field and the string that I used to filter was
as follows:
strSQL = "SELECT [DienCodes] " & "from Codes " & "WHERE [CodeID] =" & CatID
& " " & "ORDER BY [DienCodes];"

I want to add a nother filer item (WHERE) and have tried the following mod.
to the above string::

strSQL = "SELECT [DienCodes] " & "from Codes " & "WHERE [CodeID] =" & CatID
& " " & "AND" & " " & "[CountryCode] =" & CountryCode & " " & "ORDER BY
[DienCodes];"


and this variation:

strSQL = "SELECT [DienCodes] " & "from Codes " & "WHERE [CodeID] =" & CatID
& " " & "AND" & " " & "WHERE[CountryCode] =" & CountryCode & " " &
"ORDER
BY
[DienCodes];"

Can you tell me if I am doing something wrong because the above string will
not filter by the twotable field identifiers, CodeID and CountryCode.

Any assistance is greatly appreciated!

DH
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top