macro condition-urgent

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I would like to open a form "enter address for customers"
when a query "customers " has at least 1 record. I have
created a macro to open the form. But, i would like to
open it only if the query has atleast 1 record.

Thanks
 
Access macros are very limited in their capability, and there comes a time
when most people ditch them entirely in favour of VBA code. This is easy to
do in code:

If DCount("*", "customers") > 0 then
DoCmd.OpenForm "enter address for customers"
End If

Just put this code in a procedure attached to the event you wish to respond
to. For example, if you have a command button named cmdAddAddress, you
would put it in the cmdAddAddress_Click event procedure.
 
Thank you much!!
-----Original Message-----
Access macros are very limited in their capability, and there comes a time
when most people ditch them entirely in favour of VBA code. This is easy to
do in code:

If DCount("*", "customers") > 0 then
DoCmd.OpenForm "enter address for customers"
End If

Just put this code in a procedure attached to the event you wish to respond
to. For example, if you have a command button named cmdAddAddress, you
would put it in the cmdAddAddress_Click event procedure.
--
Good Luck!

Graham Mandeno [Access MVP]
Auckland, New Zealand

I would like to open a form "enter address for customers"
when a query "customers " has at least 1 record. I have
created a macro to open the form. But, i would like to
open it only if the query has atleast 1 record.

Thanks


.
 
Back
Top