Solved

comparing two tables based on two identical fields

Posted on 2007-12-04
10
443 Views
Last Modified: 2013-11-27
Tables:  Details, Index
Fields:  FileName, FileDate

What I would like to do is step through each record in Details, when the FileName data is identical between the two tables, the word "Present" is stored in Index.FileStatus and moves onto the next record to check.  When Details has a FileName that doesn't compare to Index, the word "Missing" is stored in Index.FileStatus and moves onto the next record to check.  When Index has a FileName that doesn't compare to Details, then that FileName, FileDate, and AppDetails (query) is run and moves onto the next record to check.  

I hope this is enough information. I appreciate any help you can provide.  I have a deadline tomorrow and this is the last piece to implement into the rest of my code and test.  Thank you.
0
Comment
Question by:mastro78
[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
  • 6
  • 4
10 Comments
 
LVL 77

Accepted Solution

by:
peter57r earned 500 total points
ID: 20410354
Using a query is the simplest approach to the first part of this.
I don't understand the third bit and the second bit doesn't make sense.

QrySetPresent:

Update [Index] inner join [Details]
on Index.filename = Details.Filename
Set Index.Filestatus = "Present"

You then say 'When Details has a FileName that doesn't compare to Index, the word "Missing" is stored in Index.FileStatus'
So you want to set Index.FileStatus to 'Missing' if the record is not present in Index.  So which record in Index would you be setting to this value?

As I said I don't understand what you want to do in the third step.
0
 

Author Comment

by:mastro78
ID: 20410548
Actually I mistyped, there will be no need for that piece.
0
 

Author Comment

by:mastro78
ID: 20410563
I do have another question off topic, what is the best way to store data using a function?  I currently have a function where I'm calculating and then calling it using a text box source (ie =GetCalc).  What would be a better way of doing that so that when I open up my form, the calculation is already in place in the field.  Just a general answer will do...or if you need my code I can provide that as well.
0
Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

 
LVL 77

Expert Comment

by:peter57r
ID: 20410693
If you have a calculated control it should produce the answer as soon as you open the form.
It should recalculate as you navigate from record to record or if you change any value in the record used by the calculation.  Is that not happening for your control?



0
 

Author Comment

by:mastro78
ID: 20410733
The calculation works, but I want to store it each time since the factors that effect that control don't change too often so I'm running unnecessary calculations.
0
 
LVL 77

Expert Comment

by:peter57r
ID: 20410815
If the calculation is correct at all times then you should probably leave it as a calculated value.
One possible reason for storing the value would be the need to know what the value was when it was previously calculated, because the value might be calculated differently now. Another might be that the calculation involves processing 10's of thousands of records.
Otherwise don't store it.  If you do,  you can have my personal guarantee that one day the saved answer will be wrong because one of the values used in the calculation has changed but the stored answer hasn't(:-)



0
 

Author Comment

by:mastro78
ID: 20410883
True.  I was debating on whether or not to.
0
 

Author Comment

by:mastro78
ID: 20410899
I've been messing with my application to call items in different places and have basically screwed it up.  Would you mind taking a look at my code for me?  Or should i open up another question?
0
 
LVL 77

Expert Comment

by:peter57r
ID: 20410947
I think you start another Q.  Then you will get more people looking at it.
0
 

Author Closing Comment

by:mastro78
ID: 31412696
Always very helpful
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

In a multiple monitor setup, if you don't want to use AutoCenter to position your popup forms, you have a problem: where will they appear?  Sometimes you may have an additional problem: where the devil did they go?  If you last had a popup form open…
As tax season makes its return, so does the increase in cyber crime and tax refund phishing that comes with it
Familiarize people with the process of utilizing SQL Server views from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Access…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

739 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