Results 1 to 2 of 2
  1. #1
    Join Date
    Apr 2010

    Unanswered: compile error: expected: expression

    hi all,
    i am new to vba programming i am trying to create a recordset in vba access 2007 my code is :
    Sub name()
    Dim cnn1 As ADODB.Connection
    Set cnn1 = CurrentProject.Connection
    Dim myRecordSet As New ADODB.Recordset
    myRecordSet.ActiveConnection = cnn1
    myRecordSet.Open "SELECT company FROM Table1", CurrentProject.Connection, adOpenForwardOnly, adLockReadOnly
    End Sub
    i am facing an error saying that :compile error: expected: expression
    please try to help me out where i have to change my code.

  2. #2
    Join Date
    Mar 2009
    Provided Answers: 15
    Name is a reserved word in Access. You cannot use it to name a function.
    Have a nice day!

Posting Permissions

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