VB & Access problem

R

Rupali

I am trying to create a (Access 2000) table
programmatically using VB 6.0 ADO and create table
command. A field with Number data type in the table
defaults to field size double. My problem is I want the
field size to be Long Integer and not Double.
have a look at the code i am using-
Set rs1 = con.OpenSchema(adSchemaTables)
Do While Not rs1.EOF
If (rs1!Table_Name) = tbl_name Then
con.Execute "drop table " & tblname
sql = "create table main(Distcode Text(2),bcode Text
(4),tcode Text(10),puccar Number)"
con.Execute (sql)
end if
Can anyone give the solution to my problem?
 
T

Tim Ferguson

sql = "create table main " & _
"( DistCode Text(2), " & _
" BCode Text(4), " & _
" TCode Text(10), " & _
" PucCar Number)"


What, no Primary Key? You aren't making a table then.

The data type for a 4-byte integer is INT or INTEGER, so the last line
should be

" PucCar INT)"

Data types are described in help: look for section on Transact-SQL.

Hope that helps

Tim F
 

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

Top