Error says "the expression you entered contains invalid syntax" in ACCESS VB code-VBForums
Results 1 to 3 of 3

Thread: Error says "the expression you entered contains invalid syntax" in ACCESS VB code

  1. #1

    Thread Starter
    New Member
    Join Date
    Nov 2008
    Posts
    2

    Exclamation Error says "the expression you entered contains invalid syntax" in ACCESS VB code

    hi,
    I am using MS ACCESS 2003 and using VB code within Access to toggle the screen from datasheet view to form view. code wht i am entering is:

    Code:
    Public Sub Toggle()
       
        'Toggles the view as the form between datasheet view and form view
        'It is going to check the form view
        If Me.CurrentView = 1 Then
            'form View is Single Form Change to Datasheet
            DoCmd.RunCommand (acCmdDatasheetView)
        Else
            'form View is Datasheet Change to Single Form
            DoCmd.RunCommand (acCmdFormView)
        End If
    End Sub
    when entering code i am getting the error:
    "the expression you entered contains invalid syntax" , If anyone could advise me then will be appreciated.

    Plz accept my ignorance if i miss any thing as i am new to this forums.

  2. #2
    Fanatic Member pvbangera's Avatar
    Join Date
    Sep 2001
    Location
    Mumbai, India
    Posts
    961

    Re: Error says "the expression you entered contains invalid syntax" in ACCESS VB code

    Surprisingly this code works fine for me! WOuld like to ask you 2 questions:

    1. At which line the error is generated? Try using On Error statement get exact error.
    2. On which event you are calling this procedure?
    Microsoft Techie

  3. #3

    Thread Starter
    New Member
    Join Date
    Nov 2008
    Posts
    2

    Re: Error says "the expression you entered contains invalid syntax" in ACCESS VB code

    we find the error where there is Subform including on the form on below line,
    DoCmd.RunCommand (acCmdFormView).
    and when i remove the subform it works fine.
    I am calling on the button of menu bar.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Featured


Click Here to Expand Forum to Full Width

Survey posted by VBForums.