Msg Box Script Problem

F

F1stman

Hello all,
I am having trouble with a script to check if data has been entered in a
subform and then check the values to make sure they are correct. This script
worked in another form which is almost exactly the same. I get the message,
"Run Time Error '2447'; There is an invalid use of the . (dot) or ! operator
or invalid parenthesies." I have looked at this for about an hour and tried a
variety of things. What is my problem? Please let me know. Thanks, Adam Kemp

Private Sub VerifyandClose_Click()
If (IsNull(EntryLedgerListing_AllocationForm.Form![CurrentSum]) Or
EntryLedgerListing_AllocationForm.Form![CurrentSum] <> 0) Then
MsgBox ("Attention: Invoice and entry amounts do not balance or no entry has
been made.")
End If
End Sub
 
W

Wayne-I-M

Hi

Try this

If (Eval("[Forms]![EntryLedgerListing_AllocationForm]![CurrentSum] Is
Null Or [Forms]![EntryLedgerListing_AllocationForm]![CurrentSum]<>0")) Then
MsgBox "Attention: Invoice and entry amounts do not balance or no
entry has
been made.", vbOKOnly, "Box Title"
End If


Hope this helps
 
B

BruceM

Is this code running from within EntryLedgerListing_AllocationForm? If so,
you can reference [CurrentSum] something like this:
If IsNull (Me.CurrentSum) Or Me.CurrentSum <> 0 Then
MsgBox "Attention: Invoice and entry amounts do not balance or no entry
has been made"
End If
 
F

F1stman

The script is triggered by clicking a button on the parent form,
InvoiceEntry_AllocationForm. As I said, this worked before. I have tried both
suggestions from above with the same message appearing on one and a "name nor
found" on the other. I have verified all names and references. Thanks for any
additional help.

Private Sub VerifyandClose_Click()
If IsNull([EntryLedgerListing_AllocationForm].Form![CurrentSum]) Or
[EntryLedgerListing_AllocationForm].Form![CurrentSum] <> 0 Then
MsgBox "Attention: Invoice and entry amounts do not balance or no entry
has been made."
End If
End Sub

BruceM said:
Is this code running from within EntryLedgerListing_AllocationForm? If so,
you can reference [CurrentSum] something like this:
If IsNull (Me.CurrentSum) Or Me.CurrentSum <> 0 Then
MsgBox "Attention: Invoice and entry amounts do not balance or no entry
has been made"
End If

F1stman said:
Hello all,
I am having trouble with a script to check if data has been entered in a
subform and then check the values to make sure they are correct. This
script
worked in another form which is almost exactly the same. I get the
message,
"Run Time Error '2447'; There is an invalid use of the . (dot) or !
operator
or invalid parenthesies." I have looked at this for about an hour and
tried a
variety of things. What is my problem? Please let me know. Thanks, Adam
Kemp

Private Sub VerifyandClose_Click()
If (IsNull(EntryLedgerListing_AllocationForm.Form![CurrentSum]) Or
EntryLedgerListing_AllocationForm.Form![CurrentSum] <> 0) Then
MsgBox ("Attention: Invoice and entry amounts do not balance or no entry
has
been made.")
End If
End Sub
 
W

Wayne-I-M

ooops - sorry forgot about the "sub" bit

You didn't say what the forms were called other than one of them is
"EntryLedgerListing_AllocationForm"

So change the MainFormName and SubFormName below to what they are.

Have fun


If (Eval("[Forms]![MainFormName]![SubFormName].[Form]![CurrentSum] Is
Null Or [Forms]![MainFormName]![SubFormName].[Form]![CurrentSum]<>0")) Then
MsgBox "Attention: Invoice and entry amounts do not balance or no
entry
has been made", vbOKOnly, ""
End If


--
Wayne
Manchester, England.



F1stman said:
The script is triggered by clicking a button on the parent form,
InvoiceEntry_AllocationForm. As I said, this worked before. I have tried both
suggestions from above with the same message appearing on one and a "name nor
found" on the other. I have verified all names and references. Thanks for any
additional help.

Private Sub VerifyandClose_Click()
If IsNull([EntryLedgerListing_AllocationForm].Form![CurrentSum]) Or
[EntryLedgerListing_AllocationForm].Form![CurrentSum] <> 0 Then
MsgBox "Attention: Invoice and entry amounts do not balance or no entry
has been made."
End If
End Sub

BruceM said:
Is this code running from within EntryLedgerListing_AllocationForm? If so,
you can reference [CurrentSum] something like this:
If IsNull (Me.CurrentSum) Or Me.CurrentSum <> 0 Then
MsgBox "Attention: Invoice and entry amounts do not balance or no entry
has been made"
End If

F1stman said:
Hello all,
I am having trouble with a script to check if data has been entered in a
subform and then check the values to make sure they are correct. This
script
worked in another form which is almost exactly the same. I get the
message,
"Run Time Error '2447'; There is an invalid use of the . (dot) or !
operator
or invalid parenthesies." I have looked at this for about an hour and
tried a
variety of things. What is my problem? Please let me know. Thanks, Adam
Kemp

Private Sub VerifyandClose_Click()
If (IsNull(EntryLedgerListing_AllocationForm.Form![CurrentSum]) Or
EntryLedgerListing_AllocationForm.Form![CurrentSum] <> 0) Then
MsgBox ("Attention: Invoice and entry amounts do not balance or no entry
has
been made.")
End If
End Sub
 

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