Charity
02-24-2006, 01:19 PM
I am trying to reference a textbox on my subform from a button on my main form. When I click my button, I want it to look at the hourly pay rate on my subform and tell me if it is >= or < $10 by returning yes/no in a textbox on my mainform. Here is my code, but I want to replace txtHourlyRate (which is an unbound textbox I added to my mainform just to see if I could get the rest of my code to work) with the field from my subform. Any suggestions on what I need to do?
Private Sub btnDavisBacon_Click()
' When the button is clicked it will look at the hourly rate and
' if it is less than $10/hr it will return a result of no,
' if it is greater than $10/hr it will return a result of yes.
Dim Hourly_Rate As Double
Dim Result As String
Me.txtHourlyRate.SetFocus
Hourly_Rate = CDbl(Me.txtHourlyRate.Text)
If Hourly_Rate >= 10 Then
Result = "Yes"
End If
If Hourly_Rate < 10 Then
Result = "No"
End If
Me.Meets_Davis_Bacon_Requriements_.SetFocus
Me.Meets_Davis_Bacon_Requriements_.Text = Result
End Sub
Thanks,
Charity
Private Sub btnDavisBacon_Click()
' When the button is clicked it will look at the hourly rate and
' if it is less than $10/hr it will return a result of no,
' if it is greater than $10/hr it will return a result of yes.
Dim Hourly_Rate As Double
Dim Result As String
Me.txtHourlyRate.SetFocus
Hourly_Rate = CDbl(Me.txtHourlyRate.Text)
If Hourly_Rate >= 10 Then
Result = "Yes"
End If
If Hourly_Rate < 10 Then
Result = "No"
End If
Me.Meets_Davis_Bacon_Requriements_.SetFocus
Me.Meets_Davis_Bacon_Requriements_.Text = Result
End Sub
Thanks,
Charity