G
Guest
Hello all,
Ive want to make sure all the fields on a form are filled in so iv created a
function to go through the fields passed as parameters and check to see if
they are "" or not (im using the Nz function to evaluate all nulls to "" so i
can pass them as parameters).
The problem im having is that within the function there are if statements
like:
If (Flat = "") Then
StrMsg = msgbox("Please fill in the FlatNo box and try again")
Forms![StrFormName]![Flat].SetFocus
checkAddress = False
else
if (block ="") then
.........
Where strFormName is a parameter value that passes the name (me.name) of the
calling form to the function so i can use it to evalate several forms that
have a similar layout.
The calling statement and the function header is shown below:
checkAddress(FormsName, Nz(Me![year], ""), Nz(Me![Building], ""),
Nz(Me![Block], ""), Nz(Me![Flat], ""), Nz(Me![Room], ""), Nz(Me![Surname],
"")) Then
Public Function checkAddress(StrFormName As String, year As String, Building
As String, Block As String, Flat As String, Room As String, Surname As
String) As Boolean
My problem is that i get an error message when this runs that tells me that
it cant find the form 'strFormName', why is this so?
Ive want to make sure all the fields on a form are filled in so iv created a
function to go through the fields passed as parameters and check to see if
they are "" or not (im using the Nz function to evaluate all nulls to "" so i
can pass them as parameters).
The problem im having is that within the function there are if statements
like:
If (Flat = "") Then
StrMsg = msgbox("Please fill in the FlatNo box and try again")
Forms![StrFormName]![Flat].SetFocus
checkAddress = False
else
if (block ="") then
.........
Where strFormName is a parameter value that passes the name (me.name) of the
calling form to the function so i can use it to evalate several forms that
have a similar layout.
The calling statement and the function header is shown below:
checkAddress(FormsName, Nz(Me![year], ""), Nz(Me![Building], ""),
Nz(Me![Block], ""), Nz(Me![Flat], ""), Nz(Me![Room], ""), Nz(Me![Surname],
"")) Then
Public Function checkAddress(StrFormName As String, year As String, Building
As String, Block As String, Flat As String, Room As String, Surname As
String) As Boolean
My problem is that i get an error message when this runs that tells me that
it cant find the form 'strFormName', why is this so?