Match problem

  • Thread starter Thread starter Anna
  • Start date Start date
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.
 
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.
 
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])
 
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.
 
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.
 
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.
 
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.
 
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.
 

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

Similar Threads

Get values in real time 1
Update Query 1
Check value by DLookup 1
Problem in query 1
Error data type mismatch 2
Update query on the basis of three variables 2
Lookup 1
inserting a datetime value into sql 10

Back
Top