V vbaInet AWF VIP Local time Today, 05:46 Joined Jan 22, 2010 Messages 26,374 Jun 21, 2015 #21 Upload a sample db and a sample Excel file let me see what you're doing.
M MilaK Registered User. Local time Yesterday, 21:46 Joined Feb 9, 2015 Messages 285 Jun 21, 2015 #22 macro in Userform1 db path needs to be mapped. Thanks, Mila Attachments TEST.accdb TEST.accdb 764 KB · Views: 149 TestFile.xls TestFile.xls 1.1 MB · Views: 175 Last edited: Jun 21, 2015
V vbaInet AWF VIP Local time Today, 05:46 Joined Jan 22, 2010 Messages 26,374 Jun 21, 2015 #23 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.
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.
V vbaInet AWF VIP Local time Today, 05:46 Joined Jan 22, 2010 Messages 26,374 Jun 21, 2015 #24 Scrap that, forgot to enable macros
V vbaInet AWF VIP Local time Today, 05:46 Joined Jan 22, 2010 Messages 26,374 Jun 22, 2015 #25 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.
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.
M MilaK Registered User. Local time Yesterday, 21:46 Joined Feb 9, 2015 Messages 285 Jun 22, 2015 #26 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?
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?
V vbaInet AWF VIP Local time Today, 05:46 Joined Jan 22, 2010 Messages 26,374 Jun 22, 2015 #27 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.
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.
M MilaK Registered User. Local time Yesterday, 21:46 Joined Feb 9, 2015 Messages 285 Jun 22, 2015 #28 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
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