Simple Code Problem

Knoxville

Registered User.
Local time
Today, 09:08
Joined
Apr 30, 2002
Messages
16
I have a problem. I have built a database but now changing I to make it more efficient. In my old database I had Borrowed(tick box) and availible (tick box). I had the following code so that when the Borrowed was ticked then the availible tick box was unavailible.

If Me.Borrowed.Value = True Then
Me!Availible.Enabled = False
Else
Me!Availible.Enabled = True
End If

But now I have changed the database and need help. I have now moved the availible(tick box) to a different table and form than the borrowed tick box. How do I adapt the code to work even though they are not on the same table or form?
 
The table is irrelevant. To reference a control on another form use:

Forms!YourFormName!Available
 
Why do you need to the two tick boxes? Surely if the borrowed field is unchecked, the item is available?
 
Still not working. What I need is a code that says something like this:

If the borrowed box is ticked then the availible box is unavailible on a form named frmItemDetails.
 
What you need is a query which filters out the unavailable books, base frmItemDetails on the query and you will not need to mess around with another check box on another form
 
As Rich and DBL pointed out, your method is probably not the most effective. However, as long as both forms are going to be open at the same time, you can write a code that will modify the control on the other form:

If Me!Borrowed = -1 Then
Forms!frmItemDetails!Available.Enabled = False
Else
Forms!frmItemDetails!Available.Enabled = True
End If

If you already tried what I wrote above and it did not work, then my guess would be that you are using frmItemDetails as a subform. In which case, you would have to reference the subform through the main form:

Forms!MainForm!SubForm!Available
 

Users who are viewing this thread

Back
Top Bottom