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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Cannot append problem

Status
Not open for further replies.

Vard

Technical User
Jan 14, 2005
10
US
I have been trying to resolve a problem with writing data into a table. The code keeps giving an error..."Cannot append.."

I know the problem is with the data types in the destination table and I need to change something in this code to make it work. Any help is much appreciated.
Thanks


If recCount < 10 Then
For x = recCount + 1 To 10
criteria = "INSERT INTO tblRegistrationWeekMedia ( [Reg Id], Week ) "
criteria = criteria & "SELECT " & RegID & ", " & str$(x)
DoCmd.RunSQL (criteria)
Next x
End If
 
Have you run this first as a single SQL statement, then as a VBA statement without the for/next loop? Do these work?

 
I am responding to this without the benefit of having Access to test this out. So if Im wrong forgive me.

Access requires the table to have a key defined on the table in order to append records with SQL.

Create a key on the table then run your query.

Your query appears to be missing a source table for the sub query. Is this the entire statement? What are the data types for [Reg Id] and Week? is Week a string if so you need quotes around the string.


Amiel
amielzz@netscape.net

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top