Results 1 to 8 of 8

Syntax Error and Compile Error: Expected Line Number or Label...

Threaded View

  1. #1
    Forum Contributor
    Join Date
    03-30-2010
    Location
    Washington DC
    MS-Off Ver
    Excel 2007
    Posts
    458

    Syntax Error and Compile Error: Expected Line Number or Label...

    Hello everyone.

    I am having a strange error. This code block used to work fine. So here is what I did, I changed the part of the code that reads CurrentName from CurrentTM_ID, and that seems to have caused the error. Any suggestions?


    Private Function AddNewCustomer() As String
        Dim Customer As String
        Dim custRS As New ADODB.Recordset
        'allow the user to add New Customers to their PERSONAL customer list
        Customer = InputBox("Create a New Customer", "New Customer")
        If Customer <> "" Then
            If conn <> "" Then
                If conn.State = 1 Then
                    CreateConnection
                End If
            Else
                CreateConnection
               
            End If
            'verify the the newly entered customer does NOT already exist in the database as a customer for this TM before actually adding
    ' This is one of the few places where we will reference TM ID without referencing Sales Org
            If Not FindCustomer(Customer) Then
                conn.Execute "Insert into Customer (CustomerName, TM_ID) Values('" _
                    & Replace(Customer, "'", "''") & "','" & Sheets(VALIDATIONS).Range("CurrentTMID").Value & "')" <--------------------- Error line colored in red
                
                Application.Wait Now + TimeValue("00:00:01")
                LoadCustomers
                AddNewCustomer = Customer
            Else
                MsgBox "You already have a Customer by that Name", vbOKOnly, "Customer exists"
            End If
        End If
    End Function
    Last edited by AnthonyWB; 01-30-2011 at 10:43 PM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1