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

Please Help With DataGrid

Status
Not open for further replies.

Ferlin

Programmer
Jan 18, 2001
71
US
Hello All,

I have an application with a Datagrid (dgMileage) that I am using to record business trips in. I am using a data base class so I am not using an ADODC, but setting the Datasource myself. Everything works great with the Datagrid except one thins I'm having problems trying to figure out how to do. If you could help me with this I would be greatly appreciative.

Here is what I am trying to do, I have a Column called MILES and one called AMOUNT, I also have a variable called curAmountPerMile that's a Currency that contains the Amount the Company pays it's employees per mile.

When I click on the last Row with the * by it and start keying in the data when I get to the MILES column and key in the number of miles, I would like to take that amount and multiply it by the curAmountPerMile variable and place the answer into the AMOUNT Column.

Example: I key 100 into the MILES Column cell and the curAmountPerMile variable is set to .50, I would like to have the application place 50.00 into the AMOUNT Column cell.

How do I get the 100 out of the MILES Column Cell, and how do I set the AMOUNT column Cell. Everything I've tried so far returns an Invalid Bookmark error :-(, this row is not in the Recordset yet, because your not finished keying it in, so HOW can you set a BookMark on it?

PLEASE HELP, any help would be appreciated Thanks in advance.

Ferlin.
 
Pretty Please, I still need help with this.....
 
I use this code in a program that takes the meter usage of water each month and then sets the cost for the month. Ie the current usage is found in my form text2(7) box and the current cost per cubic foot of water is a constant of .0045 cents. Since the monthly cost is in $ I set the answer of usage times cost to round off at 2 places.then I put the answer in a text box on my form called text2(9). This function is called by my save button after entering the information in the form. Maybe you can modify it for your use.

Public Function MonthlyCost()
Dim MonthCost As Single
Dim usage As Long
Const cuftCost = 0.0045

usage = Me.Text2(7).Text
MonthCost = Round((usage * cuftCost), 2)
Me.Text2(9) = "$" & MonthCost
End Function
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top