G
Guest
I need to be able to lookup a specific record in an Indexed database using VB
code.
Table name DPS_FR_ATTORNEY has the following structure:
Atty_Num (numeric value, primary key)
First_Nme (text value, first name)
Middle_Nme (text value, middle name)
Last_Nme (text value, last name)
Firm_Nme (text value, firm name)
Addr1_Txt (text value, address)
City_Nme (text value, city name)
State_Cde (text value, state abbreviated code)
Zip_Cde (numerical value, zip code)
I need to use VB code to locate specific record in a table by supplying a
value for the Atty_Num (primary key) field. If record found, use for
printing address labels. I've attempted to use a macro calling a query to
build recordset, but called query loses search value (temp field in program)
extracted from other record and query fails.
"Select * from DPS_FR_ATTORNEY where Atty_Num =
Form![Fr_Letter_Menu]![intFindKey]". intFindKey was defined with Dim
intFindKey As Integer in program.
I'm not sure if I need to use a query to get the record, then extract needed
data, or read the DPS_FR_ATTORNEY table directly. There would be less
overhead if I could read DPS_FR_ATTORNEY table directly, lookup the record or
find the corresponding record, extract data for new results table and close..
but I'm short on vba code experience to locate that record in
DPS_FR_ATTORNEY Table. Again this table is keyed to Atty_Num field.
Any help would be appreciated, I'd like to not have to loop through the
entire file to find this specific record, when I already know if the record
exists and what its number/key is. Is there vb code or capability to
manually code this lookup/find.
thanks
Robert Nusz
Sr. Programmer Analyst II
code.
Table name DPS_FR_ATTORNEY has the following structure:
Atty_Num (numeric value, primary key)
First_Nme (text value, first name)
Middle_Nme (text value, middle name)
Last_Nme (text value, last name)
Firm_Nme (text value, firm name)
Addr1_Txt (text value, address)
City_Nme (text value, city name)
State_Cde (text value, state abbreviated code)
Zip_Cde (numerical value, zip code)
I need to use VB code to locate specific record in a table by supplying a
value for the Atty_Num (primary key) field. If record found, use for
printing address labels. I've attempted to use a macro calling a query to
build recordset, but called query loses search value (temp field in program)
extracted from other record and query fails.
"Select * from DPS_FR_ATTORNEY where Atty_Num =
Form![Fr_Letter_Menu]![intFindKey]". intFindKey was defined with Dim
intFindKey As Integer in program.
I'm not sure if I need to use a query to get the record, then extract needed
data, or read the DPS_FR_ATTORNEY table directly. There would be less
overhead if I could read DPS_FR_ATTORNEY table directly, lookup the record or
find the corresponding record, extract data for new results table and close..
but I'm short on vba code experience to locate that record in
DPS_FR_ATTORNEY Table. Again this table is keyed to Atty_Num field.
Any help would be appreciated, I'd like to not have to loop through the
entire file to find this specific record, when I already know if the record
exists and what its number/key is. Is there vb code or capability to
manually code this lookup/find.
thanks
Robert Nusz
Sr. Programmer Analyst II