Get value from another table

  • Thread starter Thread starter monkey1 via AccessMonster.com
  • Start date Start date
M

monkey1 via AccessMonster.com

I have 2 database tbl_inv and tbl_coursePayment

The form Course payment use tbl_coursePayment. The form has a field named
Invoice No which obtain the value from tbl_inv.no + 1 as a New Course Payment
Invoice no.

The process is
1. get invoice no from tbl_inv.no
2. put the tbl_inv.no + 1 as new coursePayment invoice no
3. write back the new invoice no to tbl_inv.no when the form save

I m newbie in VBA, would somebody give me some example code for my reference.

Thank you.
 
in the form properties window. in the Event tab click the ... in the
Before Update and choose code builder.
put this in there.

me.no = dmax("no","tbl_coursePayment") + 1

I assumed that your form is based on the tbl_inv. if you want to see
the new number right after creating a new record type this code in the
Before Insert event.
 
Back
Top