Results 1 to 10 of 10
  1. #1
    gunterbrink is offline Novice
    Windows 10 Access 2013 64bit
    Join Date
    Dec 2016
    Posts
    16

    compile error Method or data member not found

    Private Sub cmdJLAddJob_Click()
    'when we click on button Add there are two options
    '1 for insert and 2 to update
    If Me.txtJLID.Tag & "" = "" Then
    'this is insert new

    'Add data
    CurrentDb.Execute "INSERT INTO joblog_list(Job ID, Company Name, Company Rep Day, Company Rep Night, Well Name, Job Date) " & _


    " VALUES(" & Me.txtJLID & ",'" & Me.cboCoJLName & "','" & Me.cboJLCoRepDay & "','" & _
    Me.cboJLCoRepNight & "','" & Me.cboJLJobDate & "')"


    Me.txtJLID is giving the error

    Any suggestions

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    In my experience, it could be any of the form references in that line. Check the spelling of all of them.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    gunterbrink is offline Novice
    Windows 10 Access 2013 64bit
    Join Date
    Dec 2016
    Posts
    16
    All seem to be spelled correctly. It highlights the txtJLID. I checked the reference on the form and the text box is named txtJLID, so I don't see the issue?

  4. #4
    gunterbrink is offline Novice
    Windows 10 Access 2013 64bit
    Join Date
    Dec 2016
    Posts
    16
    So I have fixed the compile error, now I get this?
    Runtime error 3134
    Syntax error INSERT INTO

  5. #5
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    One of them spelled wrong, or? The field names with inadvisable spaces need to be bracketed. This may also help:

    http://www.baldyweb.com/ImmediateWindow.htm

    date/time fields need # as the delimiter, not '.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  6. #6
    CJ_London is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,430
    may not be the reason for your error, but your sql doesn't look correct - you have spaces in your field names, so need to use square brackets. Also you are wanting to populate 6 fields, but only providing 5 values.

    And if your previous reference here

    If Me.txtJLID.Tag & "" = "" Then

    works, then it is likely the error message is misleading

  7. #7
    Missinglinq's Avatar
    Missinglinq is offline VIP
    Windows 7 64bit Access 2007
    Join Date
    May 2012
    Location
    Richmond (Virginia, not North Yorkshire!)
    Posts
    3,018
    I believe the original problem came about because of a missed space. I think that

    " VALUES(" & Me.txtJLID

    should have been

    " VALUES (" & Me.txtJLID
    The problem with making anything foolproof...is that fools are so darn ingenious!

    All posts/responses based on Access 2003/2007

  8. #8
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    Doubt it. That would cause an execution error, not a compile error.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  9. #9
    Jomar is offline Novice
    Windows 7 64bit Access 2013 32bit
    Join Date
    Jan 2017
    Posts
    1
    How were you about to solve this ? I am currently having th same problem


    Quote Originally Posted by gunterbrink View Post
    All seem to be spelled correctly. It highlights the txtJLID. I checked the reference on the form and the text box is named txtJLID, so I don't see the issue?

  10. #10
    John_G is offline VIP
    Windows 7 32bit Access 2010 32bit
    Join Date
    Oct 2011
    Location
    Ottawa, ON (area)
    Posts
    2,615
    Try changing Me.txtJLID to Me!txtJLID, i.e. use the "!" instead of "."

    Access is getting more and more finicky about this, and it has given me errors for the same thing.

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

Similar Threads

  1. Replies: 3
    Last Post: 12-24-2016, 12:42 PM
  2. Compile Error: Method or data member not found
    By JustinC in forum Programming
    Replies: 4
    Last Post: 11-18-2014, 10:25 AM
  3. Replies: 3
    Last Post: 06-27-2014, 01:09 AM
  4. compile error method or data member not found???
    By chuman vishal in forum Programming
    Replies: 2
    Last Post: 02-26-2013, 01:57 PM
  5. Compile Error: Method or data member not found
    By subtilty in forum Programming
    Replies: 5
    Last Post: 02-09-2012, 07:56 AM

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