Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Long string truncated

Status
Not open for further replies.

lynns

Technical User
Mar 1, 2000
9
0
0
US
I am trying to write a query to append records to an existing database ie.

Dim sSql2 As String

sSql2 = "INSERT INTO MyTable ( Field1, ..., Field13 )

SELECT " & T1 & " as Field1 , " & ........ & T13 & " as Field13;"

DoCmd.RunSQL sSql2

The problem is that Access truncates the string to approximately 254 characters and I get an error with the insert into statement.

I have tried

Dim sSql2 as string *512

with the same results. I can paste the code into a blank query and it will run ok so I think that the logic is good just that Access truncates my string.

Any ideas?

Thanks

lynnS
 
Instead of running one long INSERT INTO statement, why not split it into two operations? Run an INSERT INTO followed by an UPDATE...WHERE

Another alternative would be to append to a recordset in you code. [pc2]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top