Y
Yblitzka
I have a main form, with a subform in it. The subform pulls a recordset from
a table and displays it, blah blah blah.
When I close the main form, I have a specially designed close function for a
few extras, but I need to add one thing. I want to check if any of the
records in the set the subform pulls have a null value in a certain field
(the same field in eache record). If the field is null for any of the
records, I want to set the focus to that particular field in that particular
record, then end the close procedure (so the form won't be closed until that
field is filled in for all the records)
I've gotten this far:
Set rstBigSet = dbs.OpenRecordset("SELECT * FROM mytable
WHERE PKey = " & Me!PKey, dbOpenForwardOnly, dbSeeChanges)
While Not rstBigSet.EOF And Not rstBigSet.BOF
If IsNull(rstBigSet!Date) Then
MsgBox "You must enter a date!", vbInformation, "MISSING DATE"
Forms!frmBigForm!tabLittleForm.SetFocus
Forms!frmBigForm!tabLittleForm!Date.SetFocus '*********'
Exit Sub
End If
rstBigSet.MoveNext
Wend
rstBigSet.Close
dbs.Close
with everything initialized, of course. That code generates an error -
"Object doesn't support this property or method - which I assume the starred
line throws.
But it does set the focus to the first field of the first record on the
subForm. I need to replace the starred line with something else.
Is there a way to do this? Is it possible? I would think it is, but I can't
seem to find the work around yet.
Thanks,
~Yb
a table and displays it, blah blah blah.
When I close the main form, I have a specially designed close function for a
few extras, but I need to add one thing. I want to check if any of the
records in the set the subform pulls have a null value in a certain field
(the same field in eache record). If the field is null for any of the
records, I want to set the focus to that particular field in that particular
record, then end the close procedure (so the form won't be closed until that
field is filled in for all the records)
I've gotten this far:
Set rstBigSet = dbs.OpenRecordset("SELECT * FROM mytable
WHERE PKey = " & Me!PKey, dbOpenForwardOnly, dbSeeChanges)
While Not rstBigSet.EOF And Not rstBigSet.BOF
If IsNull(rstBigSet!Date) Then
MsgBox "You must enter a date!", vbInformation, "MISSING DATE"
Forms!frmBigForm!tabLittleForm.SetFocus
Forms!frmBigForm!tabLittleForm!Date.SetFocus '*********'
Exit Sub
End If
rstBigSet.MoveNext
Wend
rstBigSet.Close
dbs.Close
with everything initialized, of course. That code generates an error -
"Object doesn't support this property or method - which I assume the starred
line throws.
But it does set the focus to the first field of the first record on the
subForm. I need to replace the starred line with something else.
Is there a way to do this? Is it possible? I would think it is, but I can't
seem to find the work around yet.
Thanks,
~Yb