I have a system with 2 tables (tblMain, tblSec) and one form and one subform.
The tblMain has main data at the main form (fCod (key), fName, fAddress, fPhone, etc.) and the tblSec has some specific data that can repeat sometimes, others no (fCod, fName -pick name data from main form - fPaymantValue, fDate, fBank, etc.) for each work that each person can do, many times.
I’m working a way for when I add a new register at the subform for an specific person and the data at the fields at the tblSec for the same name won’t change, I’d not need to write them again and these fields would populate automatically.
I have build the following query that make this work: qryDayWork
=========================
SELECT tblSec.fName, tblSec.fPaymant, tblSec.Bank, tblSec.Agency, tblSec.CashCount, tblSec.CPF, tblSec Main.RG
FROM tblSec
WHERE (((tbl tblSec.fName)=[Forms]![frmMain]![Name]) AND ((tblSec.fPaymant) Is Not Null) AND ((tblSec.Bank) Is Not Null) AND ((tblSec.Agency) Is Not Null) AND ((tblSec.CashCount) Is Not Null) AND ((tblSec.CPF) Is Not Null) AND ((tblSec.RG) Is Not Null));
=========================
What I need and I have no idea is how to write a code for populate these fields at subfomr when still there is a register of them (at tblSec) for that person and preferentially the last data added. It would have to check if there is any data previously added or not, inform that (msgbox) and populate them with the Query results.
Anyone could help me?
Thanks a lot.
Ivan Sinigaglia (Brasil)