Hi,
in db of Access 2003 I have a Form “fr_lath” with a TxtBox “kim1333”.
The control source of this TxtBox is “=Count([cοd_ame])”.
[cod_ame] is a field in this Form.
This way I have in “kim1333” the number of records in this Form.
In another Form “fr_dask” there is a CmdBox “ent13” clicking on which you go to this code:
Private Sub ent13_Click()
‘1. Close form “fr_dask”
DoCmd.Close ‘close form “fr_dask” ‘It works
‘2. Open form (“fr_lath”)
DoCmd.OpenForm (“fr_lath”) ‘It works
‘3. Under this line it doesn’t work
If Me.Form.Control(“kim1333”)>0 Then MsgBox “Try again”
‘That means there are records in Form “fr_lath” and with a click on “O.K.” of MsgBox I stay in Form “fr_lath” that is open.
If Me.Form.Control(“kim1333”)=0 Then DoCmd.RunMacro "m"
‘That means there are no records in Form “fr_lath” and I want after this to auto run a macro named "m"
End Sub
Could anybody help to write the correct code under line 3?
Note: “kim1333” takes values like 1,2,3…, but instead of 0 there is “”
Thanks a lot!
in db of Access 2003 I have a Form “fr_lath” with a TxtBox “kim1333”.
The control source of this TxtBox is “=Count([cοd_ame])”.
[cod_ame] is a field in this Form.
This way I have in “kim1333” the number of records in this Form.
In another Form “fr_dask” there is a CmdBox “ent13” clicking on which you go to this code:
Private Sub ent13_Click()
‘1. Close form “fr_dask”
DoCmd.Close ‘close form “fr_dask” ‘It works
‘2. Open form (“fr_lath”)
DoCmd.OpenForm (“fr_lath”) ‘It works
‘3. Under this line it doesn’t work
If Me.Form.Control(“kim1333”)>0 Then MsgBox “Try again”
‘That means there are records in Form “fr_lath” and with a click on “O.K.” of MsgBox I stay in Form “fr_lath” that is open.
If Me.Form.Control(“kim1333”)=0 Then DoCmd.RunMacro "m"
‘That means there are no records in Form “fr_lath” and I want after this to auto run a macro named "m"
End Sub
Could anybody help to write the correct code under line 3?
Note: “kim1333” takes values like 1,2,3…, but instead of 0 there is “”
Thanks a lot!