ACCESS VBA Comparing a string against a string in another table -


here's problem. have 2 tables tvehicle , tpmcl tvehicle table has list of our vehicles, , tpmcl holds when preventitive maint. done.

tvhhicle.vehicletagnumber holds actual plate number, , tpmcl.tag holds index of of number when entered, wish had tag number when loops through data comparing able match up, is:

it's comparing along lines of "xpe 269" 1 , that's not working well.

any ideas? answer may not vba answer may diferent way lookup in first place. can't find way lookup , store plate number , not index of it.

it appears think of index foreign key. thing. means if vehicaltagnumber change (e.g. bad input) referring table not need updated.

if need loop through tpmcl , need corresponding tag number can 1 of 2 things.

you use dlookup on each loop. e.g.

dim strtag string strtag = dlookup("[vehicletagnumber]", "tvhhicle","[id] = 1") 

however slow large numbers of records.

instead base record set on sql statement joins 2 table instead of opening table directly.

dim dbvehicle object  dim rstvehicle object  dim fldenumerator object  dim fldcolumns object  dim strsql string  set dbvehicle = currentdb  set rstvehicle = dbvehicle.openrecordset("tvehicle")  set fldcolumns = rstvehicle.fields   strsql = "select * tmpcl m inner join tvehicle v on m.tag = v.id"   set rsttpmcl = dbvehicle.openrecordset(strsql) 

Comments

Popular posts from this blog

jquery - Invalid Assignment Left-Hand Side -

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -