Trouble with Main and Subforms in Code

P

PHisaw

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
 
A

Albert D. Kallal

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
 
P

PHisaw

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
 
A

Albert D. Kallal

Opps...try:

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


note how I forgot the "form" qualifier above.
 
R

Reggie

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

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

Reggie
 
P

PHisaw

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Populate main form from subform record 0
Message Box for Subform 2
Subform 7
VBA Syntax for subform record source change 6
Error 2455 1
subform 0
Add code to CloseButton 1
Mimic Split Form with Two Subforms 0

Top