Trouble with Main and Subforms in Code

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am trying to get a pop-up message box to appear based on field in subform
when main form loads with following code:

Private Sub Form_Load()
If Not
IsNull(Forms![f*GeneralInformationWITHQUOTE]![fSubformStatus]![RevisedPOReceived]) Then
MsgBox "Revised PO Not Received"
End If
End Sub

I have entered this so many ways trying to get it to work and keep getting
error messages and now with the above - nothing happens!!

Please tell me what I am doing wrong! The help is greatly appreciated.

PHisaw
 
What I would do is first check if there are ANY records...and THEN check for
a null value.

In the forms on-load, I would try:

If me.fSubformStatus.RecordSetClone.RecordCount = 0 then

MsgBox "Reviesed PO not yet entered

else

if IsNull(me.fSubforStatus!RevisedPOReceived) = true then
MsgBox "Revised PO Not Received"
end if

end if
 
Albert,
The Revised PO Received is a new field. None of my records have this date
in them. So I was expecting that with any job number I entered I would get
this message. I tried the code you gave and it gave an error message:

Compile error:
Method or date member not found

and it popped back to the code with .RecordsetClone highlighted in blue.

I don't really understand code and struggle thru when I can't get anything
else to work.

Thanks for your help!

Phisaw
 
Opps...try:

If me.fSubformStatus.Form.RecordSetClone.RecordCount = 0 then


note how I forgot the "form" qualifier above.
 
PHisaw, You will also need to qualify the contro when referenced on the
following line:

if IsNull(me.fSubforStatus.Form.[RevisedPOReceived]) = true then

Reggie
 
It worked!!! Thank you guys so much for the help and quick response.

Phisaw

Reggie said:
PHisaw, You will also need to qualify the contro when referenced on the
following line:

if IsNull(me.fSubforStatus.Form.[RevisedPOReceived]) = true then

Reggie

Opps...try:

If me.fSubformStatus.Form.RecordSetClone.RecordCount = 0 then


note how I forgot the "form" qualifier above.
 
Back
Top