First Access Database from Scratch

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • rlmoore86
    New Member
    • Mar 2008
    • 1

    First Access Database from Scratch

    I need for a check box when checked to verify whether a textbox has a certain value in it's field, and if it doesn't, it needs to create a MsgBox telling the user that they must enter an amount in that field. This is my code:

    [CODE=vb]Public Function VerifyAmount()
    Dim amount As Currency
    amount = txtOpenBalance
    If amount = 0 Then
    MsgBox("Please Enter an Amount for the Open Balance", vbOKOnly, "Error") = vbOK
    txtOpenBalance. focus = True
    End If
    End Function

    Private Sub chkComplete_Cli ck()
    VerifyAmount() = vbOK
    End Sub[/CODE]

    The problem is that on the line where i create the msgbox it gives me an error saying "Compile Error: Function call on left-hand side of the assignment must return Variant or Object"

    How can I fix this?
    Last edited by Scott Price; Mar 21 '08, 05:36 PM. Reason: code tags
  • Scott Price
    Recognized Expert Top Contributor
    • Jul 2007
    • 1384

    #2
    You are trying to set the response before the response, if you understand what I'm saying :-)

    A message box returns a value, but in your code you are trying to SET it's value equal to OK. Remove the = vbOK and you should be fine.

    Regards,
    Scott

    Comment

    Working...