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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Compare Values between Local & Linked tables 1

Status
Not open for further replies.

milcman

Programmer
Dec 19, 2002
31
0
0
US
I am trying to get my front-end DB to compare a value in a linked table from the back-end to a value in a local table from the front-end. Below is a truncated snippet of my code:

===========================================================
Dim intLocal As Integer
Dim intLatest As Integer


intLocal = "Tables!tblLocalVersionNumber!intVersonNumber"
intLatest = "Tables!tblVersionNumber!intVersonNumber"


If intLocal = intLatest Then ...

I get "Error 13 - Type Mismatch"

=======================================================

I originally wrote the code with the variables "as string" and I didn't get the error, but it handled the variable as not being equal, even though the values in both tables ARE equal.

Thanks in advance for your help...



Clint Galliano
Halliburton Energy Services
BAROID PSL
"Done ONCE, Done RIGHT!"
 
Well
intLocal = "Tables!tblLocalVersionNumber!intVersonNumber"

is being interpreted as :-
set integer container intLocal

to the string value "Tables!tblLocalVersionNumber!intVersonNumber"

No wonder there's a type mismatch

I think what you need is

intLocal = DLookup("intVersonNumber","tblLocalVersionNumber", WhereClauseInHere)

If the tables are both 'Single Record' tables then you don't need the Where Clause.
However, Dlookup does not guarantee the particular record it returns if more than one record matches the Where clause.



'ope-that-'elps.



G LS
spsinkNOJUNK@yahoo.co.uk
Remove the NOJUNK to use.
 
Thanks, LittleSmudge! I didn't use the code you suggested, but thank you for pointing out what I obviously overlooked. The quotes were screwing it up. Have-a-star!!!

Clint Galliano
Halliburton Energy Services
BAROID PSL
"Done ONCE, Done RIGHT!"
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top