Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9185525
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T19:17:55+00:00 2026-06-17T19:17:55+00:00

I’m trying to run a module in Access 2003 that takes an excel file,

  • 0

I’m trying to run a module in Access 2003 that takes an excel file, if there is info in the cell, then copy the field header and cell in A1, B1, etc… as it loops through each row. There are also comments in the cells with data that need to be copied.

So in a perfect scenario the code would go through each row, cell by cell, and grab the user, the date, the cell’s data and the comment and create a new record in an already existing access table. If the cell is empty then it will be bypassed. I have 4 sheets and I know how to make code loop, I just can’t get access to pull from excel at all.

I don’t want to just import data either, it needs to be sorted with comments in tact.

Any advice would be greatly appreciated. Thanks!

Below is the closest I think I’ve gotten btw:

Sub copy3()

Dim rs2 As New ADODB.Recordset
Dim cnn2 As New ADODB.Connection
Dim cmd2 As New ADODB.Command

With cnn2
.Provider = "Microsoft.Jet.OLEDB.4.0"
.ConnectionString = "Data Source=C:\FilePath.xls;" & "Extended Properties=Excel 8.0;"
.Open
End With

Set cmd2.ActiveConnection = cnn2
cmd2.CommandType = adCmdText
cmd2.CommandText = "SELECT * FROM [Jan-Mar$] Where [Name] IS NOT NULL"
rs2.Open cmd2

While Not rs2.EOF
...Not sure what to write here but I got a msgbox to appear...
rs2.MoveNext
Wend
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T19:17:56+00:00Added an answer on June 17, 2026 at 7:17 pm

    Thanks Remou for the advice and help. This is what finally worked for me:

    Set rs = db.OpenRecordset("TestTable")
    xl.Visible = False
    
    Set ws = xl.Workbooks.Open("C:\file.xls").Sheets("Jan-Mar")
    Set rng = ws.UsedRange
    
    'Row 1 is all dates so start at Row 2
    For i = 2 To rng.Rows.Count
        'Column A contains names so start at Column B
        For j = 2 To rng.Rows(i).Cells.Count
            If rng.Cells(i, j) = "" Or rng.Cells(1, j) = "Total" Then
    
        Else
            On Error Resume Next
            rs.AddNew
            rs!EmployeeName = rng.Cells(i, 1)
            rs!Date = rng.Cells(1, j)
            rs!PointValue = rng.Cells(i, j)
            str = rng.Cells(i, j).Comment.Text
            str = Right(str, Len(str) - 14)
            'MsgBox str
            rs!Comments = str
            rs.Update
        End If
    Next
    Next
    Set rs = Nothing
    Set rng = Nothing
    ws.Parent.Close
    xl.Quit
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to find ID3V2 tags from MP3 file using jid3lib in Java.
I am trying to render a haml file in a javascript response like so:
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I know there's a lot of other questions out there that deal with this
I'm trying to convert HTML to plain text. I get many &\#8217; &\#8220; etc.
I'm trying to create an if statement in PHP that prevents a single post
I have a .ini file as follows: [playlist] numberofentries=2 File1=http://87.230.82.17:80 Title1=(#1 - 365/1400) Example
I am trying to understand how to use SyndicationItem to display feed which is
Basically, what I'm trying to create is a page of div tags, each has
I'm new to using the Perl treebuilder module for HTML parsing and can't figure

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.