Results 1 to 8 of 8
  1. #1
    MikeMairangi is offline Novice
    Windows 7 32bit Access 2007
    Join Date
    Aug 2011
    Posts
    12

    There is an invalid use of the . (dot) or ! operator or invalid parentheses

    Any help with this would be much appreciated.



    I am trying to create a simple conditional statement to prevent the triggering of a append query if the value of the submitted textboxes are "" or null. I have the following code within the update button but I get the following error

    " There is an invalid use of the . (dot) or ! operator or invalid parentheses"

    Code as follows;

    Private Sub B_LogEvent_Click()
    On Error GoTo Err_B_LogEvent_Click
    DoCmd.SetWarnings False
    Dim stDocName As String
    If (Forms![ACTIVITY].AddEvent = "") Then
    MsgBox ("You need to enter the event details before logging the event")
    Else
    stDocName = "Q-Add-Event"
    DoCmd.OpenQuery stDocName, acNormal, acEdit
    End If
    Exit_B_LogEvent_Click:
    Me.Refresh

    DoCmd.SetWarnings True
    Exit Sub

    Err_B_LogEvent_Click:
    MsgBox Err.Description
    Resume Exit_B_LogEvent_Click

    End Sub

    I know its the

    If (Forms![ACTIVITY].AddEvent = "") Then

    line causing the problem but cannot see what the issue is.

  2. #2
    ajetrumpet is offline VIP
    Windows Vista Access 2007
    Join Date
    Mar 2010
    Location
    N/A
    Posts
    2,694
    you're using an action in a conditional statement. Obviously that won't work. Moreover, actions rarely give return values, which you've specified as "". And further than that, does access even have a ".addevent" action?

  3. #3
    MikeMairangi is offline Novice
    Windows 7 32bit Access 2007
    Join Date
    Aug 2011
    Posts
    12
    AddEvent is the name of the textbox. Have I used a reserved name for the textbox?

  4. #4
    desk4tbc is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jun 2011
    Posts
    29
    Try If (Forms![ACTIVITY]!AddEvent = "") Then If AddEvent is a textbox otherwise Access is thinking it is an action or a property.
    Last edited by desk4tbc; 08-26-2011 at 12:49 PM. Reason: Grammar

  5. #5
    boblarson is offline --------
    Windows 7 64bit Access 2010 32bit
    Join Date
    Jun 2011
    Posts
    1,272
    No parens needed

    If Forms![ACTIVITY].AddEvent = "" Then

  6. #6
    MikeMairangi is offline Novice
    Windows 7 32bit Access 2007
    Join Date
    Aug 2011
    Posts
    12
    Changed it to

    If Forms![ACTIVITY].AddEvent = "Call" Then

    and still get the same error message, don't understand what the issue is.

  7. #7
    rpeare is offline VIP
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    5,442
    if activity is the name of your form and addevent is the name of a field try

    me.addevent = "call"

    or

    [forms]![activity]![addevent] = "call"

  8. #8
    MikeMairangi is offline Novice
    Windows 7 32bit Access 2007
    Join Date
    Aug 2011
    Posts
    12
    I've sorted this out. AddEvent is actually a combo box and whilst the drop downs display the text value the actual returned value is an integer so

    If IsNull([Forms]![ACTIVITY]![AddEvent]) = True

    Worked. Thanks for all the input!

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Invalid use of me
    By kman42 in forum Access
    Replies: 1
    Last Post: 04-28-2011, 12:40 PM
  2. Invalid use of Null
    By Wayne311 in forum Programming
    Replies: 4
    Last Post: 01-27-2011, 05:10 PM
  3. Invalid Argument Error
    By koper in forum Access
    Replies: 2
    Last Post: 06-14-2010, 11:22 AM
  4. Invalid Use of Null!?!
    By Kipster1203 in forum Access
    Replies: 4
    Last Post: 05-13-2010, 06:09 AM
  5. Invalid Operation
    By ScottG in forum Forms
    Replies: 0
    Last Post: 11-14-2006, 02:05 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums