Field Size: Integer to Double

B

Bre-x

I have this function to download data from a Pervasive SQL into MS Access

Public Function get_hrs(WOPRE As Double, WOSUF As Double)
Dim sql As String
sql = "SELECT * FROM WOLABOR WHERE MTWOLA_WOPRE = " & WOPRE & " And
MTWOLA_WOSUF = " & WOSUF
CurrentDb.QueryDefs("DBA").sql = sql
DoCmd.SetWarnings False
DoCmd.RunSQL "SELECT DBA.* INTO WOLABOR FROM DBA;"
DoCmd.SetWarnings True
End Function

On my new WOLABOR table I have several Fields that are Data Type = Number
and Field Size = Integer

using VBA or any other method can I change it to "Double"?

Thank you all

Bre-x
 
K

Klatuu

Rather than a make table query, define the fields, data types, and sizes you
need and use an append query.
 
F

fredg

I have this function to download data from a Pervasive SQL into MS Access

Public Function get_hrs(WOPRE As Double, WOSUF As Double)
Dim sql As String
sql = "SELECT * FROM WOLABOR WHERE MTWOLA_WOPRE = " & WOPRE & " And
MTWOLA_WOSUF = " & WOSUF
CurrentDb.QueryDefs("DBA").sql = sql
DoCmd.SetWarnings False
DoCmd.RunSQL "SELECT DBA.* INTO WOLABOR FROM DBA;"
DoCmd.SetWarnings True
End Function

On my new WOLABOR table I have several Fields that are Data Type = Number
and Field Size = Integer

using VBA or any other method can I change it to "Double"?

Thank you all

Bre-x

Simply open the Table in Design View and change the Field Size
property of those fields from Integer to Double.
No fancy coding required. You'll be done before you could finish
writing any code.
 
J

Jeff Boyce

I'm not sure I understand why...

If the data you are receiving is Integer data, changing the Access datatype
to Double won't "add" anything...

Regards

Jeff Boyce
Microsoft Office/Access MVP
 
B

Bre-x

Actually, this would to the trick

DoCmd.SetWarnings False
DoCmd.RunSQL "ALTER TABLE WOLABOR ALTER COLUMN L_RUNHRS DOUBLE;"
DoCmd.SetWarnings True

Thank you all!!
 
K

Klatuu

If instead of the RunSQL, you use the faster Currentdb.Execute, you don't
have to bother with SetWarnings. They will not fire.

Currentdb.Execute "ALTER TABLE WOLABOR ALTER COLUMN L_RUNHRS DOUBLE;",
dbFailOnError
 

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


Top