Blingo
asked on
Transfer spreadsheet data to access - overwrite existing / transfer range instead of looping
I have been shown by Kevin how to push data records from an excel spreadsheet to an access db using VB.
As a follow up to that solution, I now need to know how to overwrite the access data record with the new pushed excel record, if the value in Field1 is already in the access db.
Also, is there a way to push a named range over to the db instead of looping through the sheet and pushing record by record? Goal here is to speed up the macro.
Thanks, B.
As a follow up to that solution, I now need to know how to overwrite the access data record with the new pushed excel record, if the value in Field1 is already in the access db.
Also, is there a way to push a named range over to the db instead of looping through the sheet and pushing record by record? Goal here is to speed up the macro.
Thanks, B.
Found something but don't have time to test it:
Title: Insert records to Access from xl
Link: http://www.ozgrid.com/forum/showthread.php?t=44667
Kevin
Title: Insert records to Access from xl
Link: http://www.ozgrid.com/forum/showthread.php?t=44667
Kevin
ASKER
Thanks again Kevin. One more thing - how can I make the value of Field1 dynamic, so it checks all records as it loops through instead of being fixed as ABC123?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I've got the whole project working perfectly. You are a legend. One more question... are you a robot? I wasn't aware that humans were capable of response times that can be measured in milliseconds and your responses don't have any trace of human error. You must be some sort of AI.
>your responses don't have any trace of human error.
Ha! If only that were really true ;-)
Thank you for the complement...I've added it to my list of accolades: https://www.experts-exchange.com/M_1677072.html
Kevin
Ha! If only that were really true ;-)
Thank you for the complement...I've added it to my list of accolades: https://www.experts-exchange.com/M_1677072.html
Kevin
MyRecordset.MoveFirst
MyRecordset.Find "Field1='ABC123'"
If MyRecordset.BOF Or MyRecordset.EOF Then
MyRecordset.AddNew
End If
MyRecordset!Field1 = SourceSheet.Cells(Row, "A")
MyRecordset!Field2 = SourceSheet.Cells(Row, "B")
MyRecordset.Update
Other than using the Access DoCmd.TransferSpreadsheet statement I know of no way to bulk load a worksheet into a table with a single statement.
Kevin