Results 1 to 6 of 6
  1. #1
    subtilty is offline Novice
    Windows XP Access 2003
    Join Date
    Feb 2012
    Posts
    4

    Compile Error: Method or data member not found

    Good Afternoon all.

    I have the below code and am getting a Compile Error but the spelling is correct and the field exists and is named correctly.

    Code:
    Private Sub cmdAdd_Click()
    'add data to table
    CurrentDb.Exceute "INSERT INTO Call Table(reportnumber, vin, code, agentname, comments) " & _
    " VALUES(" & Me.txtreportnumber & "','" & Me.txtvin & " ','" & _
    Me.cbocode & "','" & Me.txtagentname & " ','" & Me.txtcomm & "')"
    
    'refresh data in list on form
    frmCallTable.Form.Requery
    End Sub
    I am getting the error on 'Me.txtcomm'

    Any help would be great.



    Many Thanks!
    Last edited by subtilty; 02-09-2012 at 05:38 AM.

  2. #2
    jzwp11 is offline VIP
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jun 2010
    Location
    Dayton, OH
    Posts
    2,901
    You are missing a single quote before me.txtReportnumber and since you have a space in your table name, it must be enclosed in square brackets

    CurrentDb.Exceute "INSERT INTO [Call Table] (reportnumber, vin, code, agentname, comments) " & _
    " VALUES ('" & Me.txtreportnumber & "','" & Me.txtvin & " ','" & _
    Me.cbocode & "','" & Me.txtagentname & " ','" & Me.txtcomm & "')"

  3. #3
    subtilty is offline Novice
    Windows XP Access 2003
    Join Date
    Feb 2012
    Posts
    4
    Hi,

    I have adjusted the code as per your reply to:
    Code:
    CurrentDb.Exceute "INSERT INTO [Call Table](reportnumber, vin, code, agentname, comments) " & _
    " VALUES('" & Me.txtreportnumber & "','" & Me.txtvin & " ','" & _
    Me.cbocode & "','" & Me.txtagentname & " ','" & Me.txtcomm & "')"
    But the error is still there. Any other idea's? Thanks so much

  4. #4
    jzwp11 is offline VIP
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jun 2010
    Location
    Dayton, OH
    Posts
    2,901
    What are the datatypes of each of the 5 fields of the call table?

  5. #5
    subtilty is offline Novice
    Windows XP Access 2003
    Join Date
    Feb 2012
    Posts
    4
    It's ok it was my bad... I spelt Execute wrong

  6. #6
    jzwp11 is offline VIP
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jun 2010
    Location
    Dayton, OH
    Posts
    2,901
    I missed that too! Glad you got it sorted out.

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

Similar Threads

  1. Replies: 21
    Last Post: 12-25-2011, 08:17 AM
  2. Why do I get a compile error?
    By shabbaranks in forum Programming
    Replies: 24
    Last Post: 10-18-2011, 07:51 PM
  3. Replies: 6
    Last Post: 09-28-2011, 09:20 PM
  4. new compile error!
    By darklite in forum Access
    Replies: 6
    Last Post: 09-02-2010, 05:13 PM
  5. compile error
    By darklite in forum Access
    Replies: 6
    Last Post: 08-31-2010, 04:27 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