Re: converting data types

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



I have tried this:

SELECT CONTACT1.ID, CONTACT1.VISIT
FROM (SELECT ID, VISIT FROM DSPC_CONTACT WHERE VISIT IN
('10','11','12','13','14')) AS CONTACT1
WHERE Cint(CONTACT1.VISIT)>12

just to be sure to have only values that can be convertyed as numbers.
It still wont work!!!!!!!!!!!!!!!!!!!!!!
'data type mismatch in criteria expression'...AGAIN?!

"Allen Browne" wrote:

> VBA has a number of type conversion functions, such as CInt(), CDbl(),
> CLng(), CVDate().
>
> If you are expecting "integer" to be long, try:
> SELECT ID
> FROM table
> WHERE CLng([visit]) > 13
>
> --
> Allen Browne - Microsoft MVP. Perth, Western Australia.
> Tips for Access users - http://allenbrowne.com/tips.html
> Reply to group, rather than allenbrowne at mvps dot org.
>
> "rocco" <rocco@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
> news:39EB3190-3F41-49C5-916E-979ADAF2FDCB@xxxxxxxxxxxxxxxx
> > Hello,
> > i need to convert values in one column in integer dtaa type to use in SQL
> > statment.
> > it seems both CAST or CONVERT wont work in JET.
> > How can I solve my problem?
> > i have tried
> > SELECT ID
> > FROM table
> > WHERE CAST(visit as integer)>13
> >
> > But it doesn't work.
> >
> > visit is a string datatype that can have values going from 1 to 21. it is
> > the visit number of my patients (don't ask why who built the Db hasn't
> > used
> > integer data type...)
> > i want to find ID that had been visited more than 13 times.
> > How can i convert visit data-type to use the code posted above?
> >
> > i'm using Access 2003 with JET (should work also on Access 2000)
> >
> > thanks
> > Rocco
>
>
>
.



Relevant Pages

  • Re: Try to code a Command Button "Clear List"
    ... > Dim varItem As Variant ... > Allen Browne - Microsoft MVP. ... rather than allenbrowne at mvps dot org. ...
    (microsoft.public.access.formscoding)
  • Re: Using Allen Brownes calendar in an event procedure
    ... Most important was not altering the return ... But it still has to be a function to work in the event property, ... Allen Browne - Microsoft MVP. ... rather than allenbrowne at mvps dot org. ...
    (microsoft.public.access.modulesdaovba)
  • Re: Debugger not breaking
    ... > delete the module, compact the database, and create the module again. ... > Allen Browne - Microsoft MVP. ... rather than allenbrowne at mvps dot org. ... >> I have an mdb file that will not stop on any breakpoint that I place in ...
    (microsoft.public.access.modulesdaovba)
  • Re: Try to code a Command Button "Clear List"
    ... It removes the highlight, but not the information contained in the ... >> Allen Browne - Microsoft MVP. ... rather than allenbrowne at mvps dot org. ...
    (microsoft.public.access.formscoding)
  • Re: Form Design - Data Entry
    ... > Your other question related to how to tab out of one subform into the next. ... > Private Sub txtJump_GotFocus ... > Allen Browne - Microsoft MVP. ... rather than allenbrowne at mvps dot org. ...
    (microsoft.public.access.forms)