Solved

Comparing file structures

Posted on 2013-06-03
4
209 Views
Last Modified: 2013-06-10
Is there a way to compare the structure of a file, e.g. Excel file that you are going to import into an Access table before you actually do the import?  If the order of the columns or the column names in the spreadsheet do not match that of the table, Access will issue a warning and abort the procedure. I would like a more "elegant" way of dealing with it, i.e., being able to determine any discrepancy beforehand and not allow the user to proceed before that happens.
0
Comment
Question by:geeta_m9
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 85

Accepted Solution

by:
Scott McDaniel (Microsoft Access MVP - EE MVE ) earned 400 total points
ID: 39216897
You'd need to open the Excel workbook through automation and examine the structure, and make your determination from there.

Here's a good example on automating Excel:

http://access.mvps.org/access/modules/mdl0006.htm

In the code at the link above, you could expand on that to review the structure. For example:

    With objActiveWkb
        If .Worksheets(1).Cells(1, 1) = "SomeValue" Then
           Msgbox "Problem found in workbook"        
    End With
0
 

Author Comment

by:geeta_m9
ID: 39216963
So, I should put this code in a module in Access?
0
 
LVL 85
ID: 39217717
Basically, yes. You'd add code like that to your Access application and run that code before you did the import. Obviously you'd have to flesh it out quite a bit to accurately review your structures and such.
0
 

Author Closing Comment

by:geeta_m9
ID: 39235558
Thanks.
0

Featured Post

Myth Busting: MongoDB Scalability (it scales!)

I was talking with one of my colleagues from our Technical Account Manager team about MongoDB’s scalability. He mentioned to me that several customers have been telling him that “MongoDB doesn’t scale!” MongoDB’s scalability was in question?

My response was, “Is that a joke?"

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Did you know that more than 4 billion data records have been recorded as lost or stolen since 2013? It was a staggering number brought to our attention during last week’s ManageEngine webinar, where attendees received a comprehensive look at the ma…
If you need a simple but flexible process for maintaining an audit trail of who created, edited, or deleted data from a table, or multiple tables, and you can do all of your work from within a form, this simple Audit Log will work for you.
The viewer will learn how to  create a slide that will launch other presentations in Microsoft PowerPoint. In the finished slide, each item launches a new PowerPoint presentation and when each is finished it automatically comes back to this slide: …
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …

632 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question