Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Query 2 cells return error if different

Status
Not open for further replies.
Aug 1, 2003
85
0
0
US
We currently have a large access database that is being created by a program called MPC. This database is loaded on 20 local user computers. I want to make sure that all the users are using the same version of the database.

Is it possible to add a "version" table in the MPC database, link it to another database that has a similar version table, and write a query that compares the two cells version #'s. Finally, take that query and embed it in a working query so if the versions are different then it creates an error, if not then continue with the original query.

I do have 2 databases temp 1 & 2 with the version tables linked as versionnumber 1 & 2. I need help with writing the query with the if statment in it.

Thanks for the help,
Dan
 
Dan,

Why not write a query linking the 2 version tables on the version field. Retrieve data and if zero records are brought back, then the versions must be different.

ATB

Darrylle



Never argue with an idiot, he'll bring you down to his level - then beat you with experience.
 
Darrylle,

Thanks for the qiuck response. I do have this

SELECT versionnumber1.version1, versionnumber2.version2
FROM versionnumber1 INNER JOIN versionnumber2 ON versionnumber1.ID = versionnumber2.ID
WHERE (((versionnumber1.version1)=IIf([versionnumber1]![version1]=[versionnumber2]![version2],True,False)));

which was done with expression builder in access. When I run the query it just shows 2 empty cells. What do I put in for the true false to make it work correctly?

Thanks,
Dan
 
Hi dan,

Remove the WHERE clause - it isn't needed, the inner join 'compares' the version number fields already.

If the query then returns 1 record - your versions are the same, if zero records - then version numbers are different.

Try it.


ATB

Darrylle

Never argue with an idiot, he'll bring you down to his level - then beat you with experience.
 
OK Darrylle,

I now have this for a query

SELECT tblversionnumber1.version1, tblversionnumber2.version2
FROM tblversionnumber1 INNER JOIN tblversionnumber2 ON tblversionnumber1.version1 = tblversionnumber2.version2;

when the #'s in version 1 & 2 match then i get a return otherwise it's blank. Now how would I embed it into another query so that if the versions match then it continues with the original query but if they don't match then it returns an error.

Thanks,
Dan
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top