Hi there,
I am trying to get a subform to be hidden when the value of a textbox (txtAllocationID) is empty but when a ID number appears I would like it to become visible again.
This is what I have tried so far but doesn't seem to work:
Am I in the right ball park or have I gone about this the wrong way?
My allocation ID is a primary key so all auto number generated and only an integer.
Please find attached images of my form with when I want it to be hidden and when I want it to be visible.
Scenario: When I enter a stock ID of 121 and search I want the subform to remain hidden as there is no Allocation ID related to that Stock ID (see attachment tblAllocated). If I was to enter a stock ID of 122 I want the subform to become visible as the stock ID has a relation with the Allocation ID 6 and therefore the textbox txtAllocation ID would display '6' in it.
Hope this makes sense and look forward to your suggestions.
I am trying to get a subform to be hidden when the value of a textbox (txtAllocationID) is empty but when a ID number appears I would like it to become visible again.
This is what I have tried so far but doesn't seem to work:
Code:
Private Sub txtAllocationID_AfterUpdate()
If Me.txtAllocationID.Value >= 0 Then
Me.frmStockAllocated.Visible = True
Else
Me.frmStockAllocated.Visible = False
End If
End Sub
Am I in the right ball park or have I gone about this the wrong way?
My allocation ID is a primary key so all auto number generated and only an integer.
Please find attached images of my form with when I want it to be hidden and when I want it to be visible.
Scenario: When I enter a stock ID of 121 and search I want the subform to remain hidden as there is no Allocation ID related to that Stock ID (see attachment tblAllocated). If I was to enter a stock ID of 122 I want the subform to become visible as the stock ID has a relation with the Allocation ID 6 and therefore the textbox txtAllocation ID would display '6' in it.
Hope this makes sense and look forward to your suggestions.