Quering Access via Excel

Upload a sample db and a sample Excel file let me see what you're doing.
 
macro in Userform1

db path needs to be mapped.

Thanks,

Mila:)
 

Attachments

Last edited:
There's no userform in the attached xls file. Please test what you're uploading before you go ahead and upload. It will save us time.
 
Right, just had a moment to look at it. Step through your code and you'll find that nextrow is returning 1 and as a result it's not entering the loop.
 
This code worked fine for me when i had id set to number.
What do you think the problem is and do you know how to solve it?
 
In that case it should work if there's a value in the ID column. Have you stepped through the code to ensure that it's actually entering the loop? Your message box is not confirmation that it was successful.

And perhaps you're looking in the wrong database.
 
Yes, I have stepped through the code and it worked if "ID" is set to number and i=1

Code:
For x = 2 To nextrow
rst.AddNew
For i = 1 To 5
rst(Cells(1, i).Value) = Cells(x, i).Value
Next i
rst.Update
Next x

Make sure you have the most recent Microsoft ActiveX Objects Data Library checked in Tool/Preferences for both Access and Excel.

I need to know if this is a bug in Access and if there is someone here who could solve this problem or please refer me to another website.

Thanks,

Mila
 

Users who are viewing this thread

Back
Top Bottom