update control

tmarsh

tmarsh
Local time
Today, 21:42
Joined
Sep 7, 2004
Messages
89
I have a form with a subform that displays equipment inventory and loan details. On the main form I have a yes/no combo box indicating if the item is on loan. The subform has a loan date and return date. How can I make it automatically change to yes if the latest detail in the subform has a loan date but a blank return date?
 
In the ON CURRENT event of the subform, put

Code:
If IsNull(Me.YourReturnDateTextBoxNameHere) or Me.YourReturnDateTextBoxNameHere = "" Then
     Forms!YourCheckBoxNameHere = True
Else
     Forms!YourCheckBoxNameHere = False
End If
 
In the ON CURRENT event of the subform, put

Code:
If IsNull(Me.YourReturnDateTextBoxNameHere) or Me.YourReturnDateTextBoxNameHere = "" Then
     Forms!YourCheckBoxNameHere = True
Else
     Forms!YourCheckBoxNameHere = False
End If
Doesn't seem to work. Would it be because YourCheckBoxNameHere is a combo box?
 
Yep, missed that. So replace
Code:
If IsNull(Me.YourReturnDateTextBoxNameHere) or Me.YourReturnDateTextBoxNameHere = "" Then
     Forms!YourCheckBoxNameHere = True
Else
     Forms!YourCheckBoxNameHere = False
End If
with
Code:
If IsNull(Me.YourReturnDateTextBoxNameHere) or Me.YourReturnDateTextBoxNameHere = "" Then
     Forms!YourComboBoxNameHere = "Yes"
Else
     Forms!YourComboBoxNameHere = "No"
End If
 
Yep, missed that. So replace
Code:
If IsNull(Me.YourReturnDateTextBoxNameHere) or Me.YourReturnDateTextBoxNameHere = "" Then
     Forms!YourCheckBoxNameHere = True
Else
     Forms!YourCheckBoxNameHere = False
End If
with
Code:
If IsNull(Me.YourReturnDateTextBoxNameHere) or Me.YourReturnDateTextBoxNameHere = "" Then
     Forms!YourComboBoxNameHere = "Yes"
Else
     Forms!YourComboBoxNameHere = "No"
End If
Thanks for that. I'm getting an invalid use of property on my como box.
 
Oops, boy I can't see well in the morning (also at other times) because you shouldn't have
Code:
Forms!YourComboBoxName
it should be
Code:
Me.YourComboBoxName
if being referenced from code on the same form and
Code:
Forms!YourFormNameHere.YourComboBoxNameHere
if being referenced from code not on that actual form.
 

Users who are viewing this thread

Back
Top Bottom