I'm trying to write a function that will pick up a Customers Email Address which inturn is pass it to another function that will sent an Email to the Customer. Before sending the Email I need to ensure the Customer has a valid Email address (ie not blank). However, the Customers Email field name may come from a number of forms so I need to qualify the Email field with the correct Form name so it has the format :- Forms!frmName!fieldname. The following code is what I have developed but I keep getting the following error when I attempt to execute it
Runtime error '424'
Set frmCurrentForm = Screen.ActiveForm
sFormName = "Forms!" & frmCurrentForm.Name & "!"
If IsNull(sFormName & fieldname) <================ this is the statement where the error is
I've tried a number of syntax scenarios but I can't seem to crack the right combinations.
Any suggestion greatfull accepted.
Note: If I qualify the field longhand - Forms!frmName!fieldName then it works, however, frmName can keep on changing