M
Mark Kubicki
=PrintOrder([me])
I have entered, as the default value for a text box on a subform, the UDF
function PrintOrder() (see below);
unfortunately, it yields result: #Name?
when I check the default value entry, it displays as (and reverts to)
=PrintOrder([me]); which I suspect is causing the problem. Access may be
looking for a field on the subform named [Me] -which does not exist. I mean
for "Me" to return the name of the subform (or more directly, the name of
the parent form-but that would be a different question). When I delete the
[]'s, they return. I suspect my approach may be flawed, and that "Me"
cannot be used in this manner (?)
Does anyone have any suggestions on where I ought to be looking for the
error?
as always, thanks in advance,
-mark
Public Function PrintOrder(frm As Access.Form)
vStr = "[Type] = '" & frm.Parent.Type & "'"
varx = DLookup("[Type]", "tblInstallationNotes", vStr)
vLen = Len(Nz(varx))
If vLen > 0 Then
PrintOrder = DMax("[PrintOrder]", "tblInstallationNotes") + 1
Else
PrintOrder = 1
End If
End Function
I have entered, as the default value for a text box on a subform, the UDF
function PrintOrder() (see below);
unfortunately, it yields result: #Name?
when I check the default value entry, it displays as (and reverts to)
=PrintOrder([me]); which I suspect is causing the problem. Access may be
looking for a field on the subform named [Me] -which does not exist. I mean
for "Me" to return the name of the subform (or more directly, the name of
the parent form-but that would be a different question). When I delete the
[]'s, they return. I suspect my approach may be flawed, and that "Me"
cannot be used in this manner (?)
Does anyone have any suggestions on where I ought to be looking for the
error?
as always, thanks in advance,
-mark
Public Function PrintOrder(frm As Access.Form)
vStr = "[Type] = '" & frm.Parent.Type & "'"
varx = DLookup("[Type]", "tblInstallationNotes", vStr)
vLen = Len(Nz(varx))
If vLen > 0 Then
PrintOrder = DMax("[PrintOrder]", "tblInstallationNotes") + 1
Else
PrintOrder = 1
End If
End Function