refer to field on subform not working

L

laavista

I have read through all the threads on this subject and have tried different
things for hours now. I really need help.

Have parent form called: f_credits
Have subform called: f_sf_CreditsUsed
Have field on subform called: CreditsUsed (short integer)
Have cmd button called: cmdDeleteRecord

User clicks on cmd button "cmdDeleteRecord". If there is anything in the
field on the subform (null or > 0), then I want to give user a message that
they cannot delete the credit record until the creditsused they previously
assigned are re-assign. I need to check the CreditsUsed field on the
subform to see if it's null or > 0. Right now, I just need to refer to the
field correctly as the error message I'm getting says that it cannot find the
field I am referring to.

I've tried the following:

===== #1 try ======

If Forms![f_sf_CreditsUsed subform]!CreditsUsed > 0 Then
MsgBox "tell user to reassign creditsused first..."
End If

(also tried if not isnull(...)

===== #2 try ======
Forms!f_Credits!f_sf_CreditsUsed.SetFocus
Forms!f_Credits!f_sf_CreditsUsed!CreditsUsed.SetFocus

If Forms!f_Credits!f_sf_CreditUsed!CreditsUsed > 0 Then
MsgBox "tell user to reassign creditsused first..."
End If

===== #3 try ======
Forms!f_Credits!f_sf_CreditsUsed.SetFocus
Forms!f_Credits!f_sf_CreditsUsed!CreditsUsed.SetFocus

If CreditsUsed > 0 Then
MsgBox "tell user to reassign creditsused first..."
End If

===== #4 try ======
If Me![f_sf_CreditsUsed].Form![CreditsUsed]
....

I've tried a lot more things with no luck.

Your help would be greatly appreciated!
 

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

Top