So as not to confuse you...
In EXCEL, the term Macro is used for a VBA script.
However, in ACCESS, there are two programing languages.
Access-Macro = Generally used for simple things and web database.
Access-VBA = Used by most of the Access programers here, I highly advise you to learn and use the VBA programing language.
As for your current situation...
You will have to use a conditional and the domain agregate functions
So open your form in design mode.
Insert an if then
insert an else tothe if then
move your open command down to the else
insert a message box into the true section
Use the
DCOUNT() in your IF() criteria (hint, you can use a wild card for the expresion and you don't have any criteria)
...
Try this yourself... if you get stuck...
IN ACC2010:
Open the macro in the editor
Click into the editing box
<ctrl><A>
<ctrl><C>
Come back to the postbox here at bytes...
Please, click on the
[CODE/] button in the post toolbar and then cut and paste your script between the
[code] [/code] tags.
If you would like to do this in VBA - there are basiclly two methods - DCount() or Recordset
<MAKE A BACKUP OF YOUR FILE> NB:This is a oneway trip for the open form. Once done you can not easily convert from VBA to Macro (yuck :P :d)
Open the form in design mode
In the ribbon, From Design Tools, Design, Tools
"Convert Form's Macros to Visual Basic."
Same section in the Ribbon,
"View Code"
If you haven't named the controls something usefull, then you'll get to hunt for
controlnamehere_ONCLICK
You can recycle the VBA code written for you, add yuor IF...THEN consturcts as