InStr - trying to set a parameter by code.

G

Guest

How can I pass a parameter set as a text field (but in the format as numbers
seperated by , e.g. 1200,1500,6000) in a table to the following , which is a
number format

I have the following in a select query


InStr([Enter Company Number separated by commas,Blank=All],[CoCd])
0 Or Is Null

Thanks
Danny
 
D

Douglas J. Steele

Try:

InStr([Enter Company Number separated by commas,Blank=All],[CoCd])
0 Or [Enter Company Number separated by commas,Blank=All] Is Null


--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)



Danny said:
How can I pass a parameter set as a text field (but in the format as
numbers
seperated by , e.g. 1200,1500,6000) in a table to the following , which is
a
number format

I have the following in a select query


InStr([Enter Company Number separated by commas,Blank=All],[CoCd])
0 Or Is Null

Thanks
Danny
 
G

Guest

Hi Douglas

This did not work - Is it poss to use the IF statement in criteria on a
select query ?

Thanks
Danny

Douglas J. Steele said:
Try:

InStr([Enter Company Number separated by commas,Blank=All],[CoCd])
0 Or [Enter Company Number separated by commas,Blank=All] Is Null


--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)



Danny said:
How can I pass a parameter set as a text field (but in the format as
numbers
seperated by , e.g. 1200,1500,6000) in a table to the following , which is
a
number format

I have the following in a select query


InStr([Enter Company Number separated by commas,Blank=All],[CoCd])
0 Or Is Null

Thanks
Danny
 
D

Douglas J. Steele

Where have you got that expression? If it's in the query grid, that's
probably the problem.

Go into the SQL of your query, and change the WHERE clause so that it reads
something like:

WHERE InStr([Enter Company Number separated by commas,Blank=All],[CoCd]) >0
Or [Enter Company Number separated by commas,Blank=All] Is Null


--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)



Danny said:
Hi Douglas

This did not work - Is it poss to use the IF statement in criteria on a
select query ?

Thanks
Danny

Douglas J. Steele said:
Try:

InStr([Enter Company Number separated by commas,Blank=All],[CoCd])
0 Or [Enter Company Number separated by commas,Blank=All] Is Null


--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)



Danny said:
How can I pass a parameter set as a text field (but in the format as
numbers
seperated by , e.g. 1200,1500,6000) in a table to the following , which
is
a
number format

I have the following in a select query


InStr([Enter Company Number separated by commas,Blank=All],[CoCd])
0 Or Is Null

Thanks
Danny
 
G

Guest

Hi Dougals

I just looked in the sql view

SELECT ETB.CoCd, ETB.Account, ETB.[Val amt loccurr2], ETB.[SumOfVal amt
loccurr2 - ETB], ETB.Expr1
FROM ETB
WHERE (((InStr([Last Names separated by commas,Blank=All],[CoCd]))>0 Or
(InStr([Last Names separated by commas,Blank=All],[CoCd])) Is Null));

The query works fine - but i was hoping to be able to set the parameter by
code or if poss to use a if statement, if that was poss
what I am trying to achieve is either have the parameter values entered by
code depening on the value of a text box on the main form or use a if
statement with the query to get the required results -

so

Forms![Legal Entity Form-CONS]![CoCode-CCC] ="311350"
set par value to 1350 and 1360 and 1450

or if the value of the main form text box = "301650"
set par va,ue to 6540 and 1320 and 7560

I have about 7 criteria like this to out in either the query if poss or in
code.

I hope the above makes sense

would apprciate your help.
regards
Danny






Douglas J. Steele said:
Where have you got that expression? If it's in the query grid, that's
probably the problem.

Go into the SQL of your query, and change the WHERE clause so that it reads
something like:

WHERE InStr([Enter Company Number separated by commas,Blank=All],[CoCd]) >0
Or [Enter Company Number separated by commas,Blank=All] Is Null


--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)



Danny said:
Hi Douglas

This did not work - Is it poss to use the IF statement in criteria on a
select query ?

Thanks
Danny

Douglas J. Steele said:
Try:

InStr([Enter Company Number separated by commas,Blank=All],[CoCd])
0 Or [Enter Company Number separated by commas,Blank=All] Is Null


--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)



How can I pass a parameter set as a text field (but in the format as
numbers
seperated by , e.g. 1200,1500,6000) in a table to the following , which
is
a
number format

I have the following in a select query


InStr([Enter Company Number separated by commas,Blank=All],[CoCd])
0 Or Is Null

Thanks
Danny
 

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