Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 379
  • Last Modified:

Populate a field only if there is data in another related table...?

I have a table that has an invoice date (tbl_qa).  I have a table that has an invoice date (tbl_invoice).  They are related through the ProjectID.  The tbl_invoice has a field called FinalPercent.  Both tables feed a seperate form (frm_qa and frm_invoice).

The user wants the qa to auto populate the invoice date ONLY if they put something in the FinalPercent field of the invoice table.

So if (of course they use forms) they put in 1/30/2013 in the invoice form and do NOT enter anything into the final percent field, nothing happens.  But if there is a date in the invoice field on the invoice form and then later on (or at that time, depends) put 75 in the final percent field, they want the invoice date on the qa table to populate with the same invoice date.

The qa form will always be open when the invoice form is open.

What is the best way to do this?

Thanks!
0
Kevin Smith
Asked:
Kevin Smith
1 Solution
 
Rey Obrero (Capricorn1)Commented:
use the afterupdate event of  the textbox for date and the textbox for final percent in the invoice form

assuming the names of the textboxes are txtDate and txtPercent in invoice form
and txtInvoiceDate in the qa form

private sub txtDate_afterupdate()

if me.txtDate & ""<>"" and me.txtPercent & "" <> "" then
   forms!frm_qa!txtInvoiceDate= me.txtDate

end if

end sub

private sub txtPercent_afterupdate()

if me.txtDate & ""<>"" and me.txtPercent & "" <> "" then
   forms!frm_qa!txtInvoiceDate= me.txtDate

end if

end sub
0
 
Kevin SmithAuthor Commented:
perfect, thanks!
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now