Open form button with conditions

Gismo

Registered User.
Local time
Today, 20:41
Joined
Jun 12, 2017
Messages
1,298
Hi all
could you please explain how the macro, open form where condition button works?
i want to open a form only if a record in that form meets a specific condition / value, if not, the form should not open
 
what is the condition?
I think you need to wrap the condition in the IF macro first before
running the OpenForm macro.
 
i want to open a form only if a record in that form meets a specific condition / value, if not, the form should not open

Basically a form will only return a set of records that its record source is linked to. This could be a table, a query or could be constructed with VBA code. The form won't/can't present you with enough information for you to decide whether to open it or not. However you may be able to open it, test it and then close it --- if it doesn't meet the requirements.

A better approach would be to test the data directly. Write a query that counts the number of Records that meet the criteria you specify, if no records meet the criteria then the query would return 0 records. If a 0 count resulted, then you could specify that the form should not open. My guess is this would be a lot easier to do with VBA. I'm not sure it could be done with macros, I don't know enough about macros to be able to answer that question.
 

Users who are viewing this thread

Back
Top Bottom