Only enabling a button if a parameter value >= 0

maxhannigan

New member
Local time
Today, 19:29
Joined
Feb 14, 2025
Messages
2
I am trying to create a search function for my database, whereas when you click a button and enter a staff ID, it should come up with a report displaying the members details. I have linked the query to a report so when a valid staff ID is input it displays all of the members information. There is an open button on this report which opens the member form to allow the user to edit the members details. Whenever an invalid staff ID is input, the report still loads with no data attatched, and when the open button is pressed it comes up with this here:
1739533598819.png


Is there any way to disable the open button if there is no data in the report, or would it be easier to code the query so it only accepts valid staff ID's, and if it is easier that way how would I go around doing it? Thanks
 
just add a Code to the Report's On No Data event, so that the report will not show:
Code:
Private Sub Report_NoData(Cancel As Integer)
Cancel = True
End Sub
 
just add a Code to the Report's On No Data event, so that the report will not show:
Code:
Private Sub Report_NoData(Cancel As Integer)
Cancel = True
End Sub
Just tried this and works even better than mine thanks a lot
 
Learn to debug your code.
Inspect StaffID. You could use NZ() function to at least give it a valid value to open on.
 

Users who are viewing this thread

Back
Top Bottom