Run-Time Error "3049"

robryanp

New member
Local time
Today, 04:59
Joined
Aug 24, 2015
Messages
4
Cannot open database..."file maybe corrupt"

After running the code on a form...I'm getting this error message. Run-Time Error "3049"

The code runs for about 100K rows and then this message comes on. I'm trying to update this table with about 300K products.

Please help.

Private Sub Command0_Click()
Dim rsF As Recordset
Dim rs1 As Recordset
Dim rs2 As Recordset

Set rsF = CurrentDb().OpenRecordset("Select * from FinalTable order by ProductCode")
Set rs1 = CurrentDb().OpenRecordset("Select * from Catalog_08222015 order by productCode")
Set rs2 = CurrentDb().OpenRecordset("Select * from Catalog_08012015_orig order by ProductCode")

Do While rs1.EOF = False
rsF.AddNew
rsF("ProductCode") = rs1("ProductCode")
rsF("Product_Group") = rs1("Product_Group")
rsF("Manufacturer") = rs2("ProductManufacturer")
rsF("CatID") = rs1("CatID")

rsF.Update
'rsF.MoveNext
rs1.MoveNext
rs2.MoveNext
Loop

MsgBox "End job"
Set rsF = Nothing
Set rs1 = Nothing
Set rs2 = Nothing



End Sub
 
In which code line do you get the error?
Did you try a "Compact and Repair"?
 
@JHB, thanks for the reply.

Yes I tried the compact and repair.
The debug mode error highlight this line.
rsF.Update
'rsF.MoveNext

But I'm not sure why it creates 100K products while later gets the error.

Thank you
 
copy the files before you try things.

what is error 3049?
 
...
But I'm not sure why it creates 100K products while later gets the error.
Maybe there is some unexpected value(s) in your tables! Does it stop each time on the same record number?
What about creating an append query instead of using a recordset?
Another way for testing is create a table and insert more times the same data which doesn't give problem, so to say 2-3 times same 90K products.
Remember to do it on a copy of the database.
 
I suspect you are hitting the 2GB limit on the destination database.
 
@JHB - compact and repair solved the problem. Thank you all for the quickly replies. Much appreciated.
 

Users who are viewing this thread

Back
Top Bottom