If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
message if parameter not found
I have a form which gets data from a parameter query. I want to send a
message if the results of the parameter is null, before is opens the form (which will be blank). I found this helpful information on this site and has worked for several other forms, but no matter what I do, this does not seem to work: It stops on the If statement. *** FYI - the query name is correct Private Sub Form_Load() If DCount("*", "Prod Find RBT Number qry") = 0 Then MsgBox "Robot number not found on that System" DoCmd.Close Else DoCmd.OpenForm "Prod Find RBT Number form" End If End Sub |
#2
|
|||
|
|||
message if parameter not found
On Thu, 23 Jul 2009 08:20:12 -0700, HYD2 wrote:
I have a form which gets data from a parameter query. I want to send a message if the results of the parameter is null, before is opens the form (which will be blank). I found this helpful information on this site and has worked for several other forms, but no matter what I do, this does not seem to work: It stops on the If statement. *** FYI - the query name is correct Private Sub Form_Load() If DCount("*", "Prod Find RBT Number qry") = 0 Then MsgBox "Robot number not found on that System" DoCmd.Close Else DoCmd.OpenForm "Prod Find RBT Number form" End If End Sub Wrong event. Code the form's Open event: If Me.RecordSetClone.RecordCount = 0 Then MsgBox "Robot number not found on that System" Cancel = True End If -- Fred Please respond only to this newsgroup. I do not reply to personal e-mail |
#3
|
|||
|
|||
message if parameter not found
"HYD2" wrote: I have a form which gets data from a parameter query. I want to send a message if the results of the parameter is null, before is opens the form (which will be blank). I found this helpful information on this site and has worked for several other forms, but no matter what I do, this does not seem to work: It stops on the If statement. *** FYI - the query name is correct Private Sub Form_Load() If DCount("*", "Prod Find RBT Number qry") = 0 Then MsgBox "Robot number not found on that System" DoCmd.Close Else DoCmd.OpenForm "Prod Find RBT Number form" End If End Sub Thank you Fred, it works Great. I am surprised that it worked on my other forms. HYD2 |
Thread Tools | |
Display Modes | |
|
|