Autopopulate a Field in a New Record Based on a Field in a Prev Re

S

silva

I am creating a database to keep track of tnant utility usage and generate
billing invoices. I already have the mathematics of portioning out who owes
what figured out. What I'm trying to do, though, is when I take a new meter
reading in, I need to grab the previous readintg as well.

For example, lets say I have Reading1 and Reading2, where Reading1 is the
new meter reading, and Reading2 is the old meter reading. I'd like to add
code to a form control button to add a new record, and upon creating, it
takes Reading1 from the previous record and stores it in Reading2 of the new
record.

The other issue I seem to have is properly distrubting data to generate
individual tenant billing invoices. As I see it, I can generate everything
within one form, but it looks like I'd need a command button to add a new
record to a separate table and populate it based on the data generated in the
form, as autopopulating the other table might prove to be inaccurate. This I
know how to do, as I've done it before, but it was done with the table linked
to the form. Based on what I'm doing, I'm not sure if I can link the table
for generating the invoices directly to the table for generating the billing
information or it's form. Would a subform work for such a thing?
 
H

Hunter57

Hi Silva,

You are going to have to have some way to choose the right account and get
the meter reading on the new record. I recommend a Combobox bound to the
Account/Customer ID. Let the first column be the Account/Customer ID and the
second the customer name and the third column the last meter reading.

Set the Column Widths to 0";2";0"
This way you will only see the Account/Customer ID.

You can select the customer by name and in code you get the meter reading by
using the AfterUpdate Event of the Combobox.

Me.MyOldMeterReadingTexbox = Me.MyComboBox.Column(2)
The columns are 0 based so you need Column(2) to add the meter reading to
your Textbox.

Invoices:
Here is a link to a tutorial that will show you step by step how to build an
Invoice Master Form and Invoice Details subform.

http://www.profsr.com/access/accless01.htm

If you run into any problems just post here again for help.

Best Regards,
Patrick (Pat) Wood
http://gainingaccess.net/
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top