|
|
|||||||||
|
|||||||||
|
|||||||||
| |
||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Referencing a form from VBA
Hi,
I'm sure this is really simple but I'm new to this. I want to multiply the values of two fields, one on the form that I'm coding behind, and another from a separate form. I keep getting an error which says that it can't find the other form. It's there, so I presume my code to reference it is wrong. Any ideas of how I should be doing this? If IsNull([Grade]) = False Then Me![Cost] = (Me![Hours Spent]) * (Forms![Lookup StaffRates]![HourlyRate]) End If |
|
#2
|
|||
|
|||
|
if the Lookup StaffRates is not open then it will have nothing to look up.
I am assuming you have some ID field relating it back to the form you are running this calculation on. in the form properties!record source. Link the other table to the open you are using. Because they are linked you should not have to look for another form. So it shuld read:- If IsNull([Grade]) = False Then Me![Cost] = (Me![Hours Spent]) * (Me![HourlyRate]) End If hope this helps |
![]() |
| Viewing: ASP Free Forums > Programming > Visual Basic Programming > Referencing a form from VBA |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|