Match problem

A

Anna

My criteria in query is:
where outlet in [tbl_events].[PPV_Outlet]
Outlet type is text and [tbl_events].[PPV_Outlet] type is number is
there any way by which i can match the values.

Thanks.
 
R

Rick Brandt

Anna said:
My criteria in query is:
where outlet in [tbl_events].[PPV_Outlet]
Outlet type is text and [tbl_events].[PPV_Outlet] type is number is
there any way by which i can match the values.

Thanks.

Assuming that the table PPV_Outlet is not otherwise included in your query
you need...

where outlet in (SELECT PPV_Outlet FROM [tbl_events])

....But it would generally be faster to add the table to your query and join
to it instead of using an IN clause although there are times where the IN
clause is the only way to accomplish something.
 
D

Douglas J. Steele

Depending on what the data type of PPV_Outlet is, try something like:

Where CLng(outlet) = [tbl_events].[PPV_Outlet]

Alternatively, you could try:

Where outlet = CStr([tbl_events].[PPV_Outlet])
 
A

Anna

Data in [tbl_events].[PPV_Outlet] is like that 1,2,3
Douglas said:
Depending on what the data type of PPV_Outlet is, try something like:

Where CLng(outlet) = [tbl_events].[PPV_Outlet]

Alternatively, you could try:

Where outlet = CStr([tbl_events].[PPV_Outlet])

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


Anna said:
My criteria in query is:
where outlet in [tbl_events].[PPV_Outlet]
Outlet type is text and [tbl_events].[PPV_Outlet] type is number is
there any way by which i can match the values.

Thanks.
 
D

Douglas J. Steele

Then see Rick's suggestion.

--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


Anna said:
Data in [tbl_events].[PPV_Outlet] is like that 1,2,3
Douglas said:
Depending on what the data type of PPV_Outlet is, try something like:

Where CLng(outlet) = [tbl_events].[PPV_Outlet]

Alternatively, you could try:

Where outlet = CStr([tbl_events].[PPV_Outlet])

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


Anna said:
My criteria in query is:
where outlet in [tbl_events].[PPV_Outlet]
Outlet type is text and [tbl_events].[PPV_Outlet] type is number is
there any way by which i can match the values.

Thanks.
 
A

Anna

It gives type mismatch error and when i use str(outlet) then it shows
no values.

outlet type text contains values like 1,2,3,4
PPV_Outlet type number

Thanks.


where outlet in (SELECT PPV_Outlet FROM [tbl_events])
Rick said:
Anna said:
My criteria in query is:
where outlet in [tbl_events].[PPV_Outlet]
Outlet type is text and [tbl_events].[PPV_Outlet] type is number is
there any way by which i can match the values.

Thanks.

Assuming that the table PPV_Outlet is not otherwise included in your query
you need...

where outlet in (SELECT PPV_Outlet FROM [tbl_events])

...But it would generally be faster to add the table to your query and join
to it instead of using an IN clause although there are times where the IN
clause is the only way to accomplish something.
 
D

Douglas J. Steele

You're saying both outlet and PPV_Outlet contain strings of numbers? I think
you're going to have to explain what these numbers mean.

--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


Anna said:
It gives type mismatch error and when i use str(outlet) then it shows
no values.

outlet type text contains values like 1,2,3,4
PPV_Outlet type number

Thanks.


where outlet in (SELECT PPV_Outlet FROM [tbl_events])
Rick said:
Anna said:
My criteria in query is:
where outlet in [tbl_events].[PPV_Outlet]
Outlet type is text and [tbl_events].[PPV_Outlet] type is number is
there any way by which i can match the values.

Thanks.

Assuming that the table PPV_Outlet is not otherwise included in your
query
you need...

where outlet in (SELECT PPV_Outlet FROM [tbl_events])

...But it would generally be faster to add the table to your query and
join
to it instead of using an IN clause although there are times where the IN
clause is the only way to accomplish something.
 
A

Anna

No, only outlet has a string of numbers because its type is text but
PPV_Outlet contains only numbers as its type is number
Douglas said:
You're saying both outlet and PPV_Outlet contain strings of numbers? I think
you're going to have to explain what these numbers mean.

--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


Anna said:
It gives type mismatch error and when i use str(outlet) then it shows
no values.

outlet type text contains values like 1,2,3,4
PPV_Outlet type number

Thanks.


where outlet in (SELECT PPV_Outlet FROM [tbl_events])
Rick said:
Anna wrote:
My criteria in query is:
where outlet in [tbl_events].[PPV_Outlet]
Outlet type is text and [tbl_events].[PPV_Outlet] type is number is
there any way by which i can match the values.

Thanks.

Assuming that the table PPV_Outlet is not otherwise included in your
query
you need...

where outlet in (SELECT PPV_Outlet FROM [tbl_events])

...But it would generally be faster to add the table to your query and
join
to it instead of using an IN clause although there are times where the IN
clause is the only way to accomplish something.
 
Top