Hey Everybody,
I have code for a command button. The button is supposed to open a query with a general criteria of: Forms![Form Name]![Control Name]. The [Column Name] field of the query should match the [Control Name] in the Form. If a record does not exist in the query for the specified control name, I want a message box to display stating so. My code is below:
What should go in the if statement?
Thanks!
I have code for a command button. The button is supposed to open a query with a general criteria of: Forms![Form Name]![Control Name]. The [Column Name] field of the query should match the [Control Name] in the Form. If a record does not exist in the query for the specified control name, I want a message box to display stating so. My code is below:
Code:
If ( ) Then ' If record exists, then open the query below. DoCmd.OpenQuery "2 - Total Reflux Tests Query", acViewNormal, acReadOnly Else ' If record does not exist, then show message below. MsgBox "No test(s) found for column " & [Column Name] & ".", vbInformation, "Sorry" End If
Thanks!
Comment