PC Review


Reply
Thread Tools Rate Thread

Conver string into number during join

 
 
Eric
Guest
Posts: n/a
 
      7th Sep 2006
Hi: When i run my query it join with Mid(tpr.AccountNum,1,5) which is
like that 00000 is it possible before i join thru mid i will convert
the AccountNum into number as ti.tech is an integer in my database of
same size.

Thanks,

SELECT ti.CORP, ti.TECH, ti.TECHCONT, tj.LstVldTech, [tpr].[Status] AS
Expr1, tpr1.TicketNum, tpr1.AccountNum
FROM ([select tpr.*, Mid(tpr.AccountNum,1,5) as tprCorp from
tbl_PPVResearch AS tpr]. AS tpr1 INNER JOIN tech_id AS ti ON
tpr1.tprCorp = ti.CORP) INNER JOIN tbl_validDisputes AS tj ON ti.TECH =
tj.LstVldTech
WHERE ((([tpr].[Status])="Complete") AND
((tpr1.TicketNum)=[tj].[ticketnum]));

 
Reply With Quote
 
 
 
 
Brendan Reynolds
Guest
Posts: n/a
 
      7th Sep 2006
You can convert the string to an integer using the CInt function ...

CInt(Mid(tpr.AccountNum, 1, 5))

If possible, though, it would be better to change one of those columns. Two
columns which represent the same thing should have the same data type.

--
Brendan Reynolds
Access MVP


"Eric" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Hi: When i run my query it join with Mid(tpr.AccountNum,1,5) which is
> like that 00000 is it possible before i join thru mid i will convert
> the AccountNum into number as ti.tech is an integer in my database of
> same size.
>
> Thanks,
>
> SELECT ti.CORP, ti.TECH, ti.TECHCONT, tj.LstVldTech, [tpr].[Status] AS
> Expr1, tpr1.TicketNum, tpr1.AccountNum
> FROM ([select tpr.*, Mid(tpr.AccountNum,1,5) as tprCorp from
> tbl_PPVResearch AS tpr]. AS tpr1 INNER JOIN tech_id AS ti ON
> tpr1.tprCorp = ti.CORP) INNER JOIN tbl_validDisputes AS tj ON ti.TECH =
> tj.LstVldTech
> WHERE ((([tpr].[Status])="Complete") AND
> ((tpr1.TicketNum)=[tj].[ticketnum]));
>



 
Reply With Quote
 
Douglas J. Steele
Guest
Posts: n/a
 
      7th Sep 2006
If the number is going to be larger than 32,767, use CLng instead of CInt.

(Brendan's right, though, that they should be the same type)

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)


"Brendan Reynolds" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> You can convert the string to an integer using the CInt function ...
>
> CInt(Mid(tpr.AccountNum, 1, 5))
>
> If possible, though, it would be better to change one of those columns.
> Two columns which represent the same thing should have the same data type.
>
> --
> Brendan Reynolds
> Access MVP
>
>
> "Eric" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
>> Hi: When i run my query it join with Mid(tpr.AccountNum,1,5) which is
>> like that 00000 is it possible before i join thru mid i will convert
>> the AccountNum into number as ti.tech is an integer in my database of
>> same size.
>>
>> Thanks,
>>
>> SELECT ti.CORP, ti.TECH, ti.TECHCONT, tj.LstVldTech, [tpr].[Status] AS
>> Expr1, tpr1.TicketNum, tpr1.AccountNum
>> FROM ([select tpr.*, Mid(tpr.AccountNum,1,5) as tprCorp from
>> tbl_PPVResearch AS tpr]. AS tpr1 INNER JOIN tech_id AS ti ON
>> tpr1.tprCorp = ti.CORP) INNER JOIN tbl_validDisputes AS tj ON ti.TECH =
>> tj.LstVldTech
>> WHERE ((([tpr].[Status])="Complete") AND
>> ((tpr1.TicketNum)=[tj].[ticketnum]));
>>

>
>



 
Reply With Quote
 
Brendan Reynolds
Guest
Posts: n/a
 
      7th Sep 2006
Hmm, well, when Eric said 'integer' I assumed he meant 'Integer' but you're
right, of course, that may not necessarily be the case! :-)

--
Brendan Reynolds
Access MVP

"Douglas J. Steele" <NOSPAM_djsteele@NOSPAM_canada.com> wrote in message
news:O$(E-Mail Removed)...
> If the number is going to be larger than 32,767, use CLng instead of CInt.
>
> (Brendan's right, though, that they should be the same type)
>
> --
> Doug Steele, Microsoft Access MVP
> http://I.Am/DougSteele
> (no e-mails, please!)
>
>
> "Brendan Reynolds" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
>> You can convert the string to an integer using the CInt function ...
>>
>> CInt(Mid(tpr.AccountNum, 1, 5))
>>
>> If possible, though, it would be better to change one of those columns.
>> Two columns which represent the same thing should have the same data
>> type.
>>
>> --
>> Brendan Reynolds
>> Access MVP
>>
>>
>> "Eric" <(E-Mail Removed)> wrote in message
>> news:(E-Mail Removed)...
>>> Hi: When i run my query it join with Mid(tpr.AccountNum,1,5) which is
>>> like that 00000 is it possible before i join thru mid i will convert
>>> the AccountNum into number as ti.tech is an integer in my database of
>>> same size.
>>>
>>> Thanks,
>>>
>>> SELECT ti.CORP, ti.TECH, ti.TECHCONT, tj.LstVldTech, [tpr].[Status] AS
>>> Expr1, tpr1.TicketNum, tpr1.AccountNum
>>> FROM ([select tpr.*, Mid(tpr.AccountNum,1,5) as tprCorp from
>>> tbl_PPVResearch AS tpr]. AS tpr1 INNER JOIN tech_id AS ti ON
>>> tpr1.tprCorp = ti.CORP) INNER JOIN tbl_validDisputes AS tj ON ti.TECH =
>>> tj.LstVldTech
>>> WHERE ((([tpr].[Status])="Complete") AND
>>> ((tpr1.TicketNum)=[tj].[ticketnum]));
>>>

>>
>>

>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Conver byte to string of 1's and 0's =?Utf-8?B?RGF2ZQ==?= Microsoft C# .NET 2 23rd Aug 2007 04:26 PM
conver text to number =?Utf-8?B?c2llcnJhbGlnaHRmb290?= Microsoft Access Queries 5 19th Apr 2007 12:32 PM
Conver General number to Currency ellenricca@gmail.com Microsoft Excel Discussion 2 4th May 2006 07:33 PM
How to conver string to color Boni Microsoft VB .NET 3 31st Oct 2005 12:51 PM
Conver text to number in VBA MSN Microsoft Excel Programming 1 2nd Nov 2003 12:38 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 11:09 AM.