mreference
Registered User.
- Local time
- Today, 02:28
- Joined
- Oct 4, 2010
- Messages
- 137
Hi, I have form (MAIN FORM) with a field that performs a Dcount on a table, if the value of that field is greater than 1, a command button will appear underneath that allows the user to open a pop-up form (POPUP FORM) with the records associated with the Dcount.
If the user deletes the records on the POPUP FORM, when they close the form, I used the following VBA on the close button to refresh the MAIN FORM which works perfectly, and the MAIN FORM will update the Dcount.
Forms!frmProduct_Detail_Add.Form.Refresh
However, the command button on the main form that is only visible if the Dcount value is greater than 1, does not disappear when the Dcount value updates to 0 from the refresh if the user deletes the records.
I have included the following VBA on the MAIN FORM on these events
On Current
On Open
the Dcount Field
If Me.txtItemstoOrder > 0 Then
Me.cmdStocktoOrder.Visible = True
ElseIf Me.txtItemstoOrder = 0 Then
Me.cmdStocktoOrder.Visible = False
End If
I just can't get this button to hide if the value reverts to 0 after the user has deleted the records, and clicking on the button with no records brings up an error and a very odd looking Pop-Up form not in the position I set it to appear.
I also tried closing the MAIN FORM and reopening it, but as I have a number automatically generated on a data entry form, when it opens it doesn't reopen the record I was working on.
Any help would be appreciated
If the user deletes the records on the POPUP FORM, when they close the form, I used the following VBA on the close button to refresh the MAIN FORM which works perfectly, and the MAIN FORM will update the Dcount.
Forms!frmProduct_Detail_Add.Form.Refresh
However, the command button on the main form that is only visible if the Dcount value is greater than 1, does not disappear when the Dcount value updates to 0 from the refresh if the user deletes the records.
I have included the following VBA on the MAIN FORM on these events
On Current
On Open
the Dcount Field
If Me.txtItemstoOrder > 0 Then
Me.cmdStocktoOrder.Visible = True
ElseIf Me.txtItemstoOrder = 0 Then
Me.cmdStocktoOrder.Visible = False
End If
I just can't get this button to hide if the value reverts to 0 after the user has deleted the records, and clicking on the button with no records brings up an error and a very odd looking Pop-Up form not in the position I set it to appear.
I also tried closing the MAIN FORM and reopening it, but as I have a number automatically generated on a data entry form, when it opens it doesn't reopen the record I was working on.
Any help would be appreciated