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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using Sub form data inm a main form

Status
Not open for further replies.

bubbliejock

Technical User
Oct 21, 2003
3
0
0
GB
How do use record information in a sub form to calculate an unbounded record in the parent form

My subform pulls up the price for a room, category and rate which is specified in the main form.

I want to muliply this price with the No of hours the room is used for, which is in the main form.
 
In the after update event of the Price control put this code:

forms![MainFormName].[SubtotalControlName] = Me![Price].value * forms![MainFormName].[NumberofHoursControlName].value

That should work.

If I take a peek in your Windows, to fix a problem, does that make me a "Peeping Tom"? Hmmmmmmmmmmv [pc1][shocked]
 
bubbliejock, what you want is known as DSum procedure. Not my strength but this should get you started.
Dim intRoomUsage As Integer
intRoomUsage = DSum([Me.Hours]*[Me.Parent.Rate], "tblMainTable",[Me.Catagory]
Of course you will have to change the names to your names.
This should order it by category, I think, I don't use Dsum alot, but I have seen it a few times. I hope this works for you good luck.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top