Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Run query in order to assign a control a value

Status
Not open for further replies.

Harr777

Programmer
Sep 25, 2003
71
US
Hello,

I'm trying asign a control on my form with a value from a query and I'm having a heck of a time trying to do so. I've been trying to put in VBA code in an event procedure.
Any suggestions?
 
Harr777,

What type of control are you working with and what is the goal for using the query?

Thanks,

Steve
 
Steve,

The purpose of the control (which is a text box)is to display the last meter read on a machine. The main forms data source is the meter reads table. The value of the last read needed is from the machine table, hence the need for the query.
In the end I need to display the last read (taken from the Machines Table), the new read (entered in the form goes in the meter reads table), calculate the differance (the monthly total, which goes in the meter reads table), and finally assign the new read value to the machine tables LastRead value.
I beleive the this would best be done using VBA code. I'm a little new to Access. Do you have any suggestions how?
Also, could you tell me: I wanted to back this form on a query in the first palce, but I looked like if I did so, I wouldn't be able to save records. Is that the case with forms in general.

Thanks.
 
Harr777,

Instead of creating a query to do this you can code within vba to pull the max value of the recordset. I can write out the code for you but need more information on how this form is setup and what the fields are on the machine table and meter reads table.

it would be faster if you can zip the db to me.

kennethp@webmpt.com

Currently seeking for position around Boston, MA. kenphu@yahoo.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top