Results 1 to 5 of 5
  1. #1
    johnnyBQue is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Oct 2014
    Posts
    33

    Method or Data Member not found

    What is highlighted by the compiler is "cboHmCellWk2" in the line of code starting with (" VALUE) in (Me.cboHmCellWk2)

    I've used this code in several forms for my "Add" button with no problems but I can't seem to find the issue here. My eyes are hurting...also I'm VERY new at code writing so my syntax identification an use is weak at the most...I think my issue is (I have no clue) but possibly between the quotes starting at (" VALUE and ending at Me.cboHmCellWk2 & "')



    thanks...


    Click image for larger version. 

Name:	Compiler error.GIF 
Views:	16 
Size:	49.8 KB 
ID:	18556

  2. #2
    johnnyBQue is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Oct 2014
    Posts
    33
    I missed spelled execute but now I'm getting syntax error in the "INSERT INTO" section...I'll keep looking

  3. #3
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,815
    You have special characters/punctuation (the /) in field names. This might cause an issue. Enclose the field names in [].

    Also, text fields require apostrophe delimiters for data parameters. Dates use # delimiter.

    You have a solo apostrophe at the end of the sql.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  4. #4
    ssanfu is offline Master of Nothing
    Windows XP Access 2000
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    I like to use a variable for the SQL so I can see what the SQL statement looks like:

    Code:
    Private Sub cmdAdd_Click()
        Dim sSQL As String
    
        If Me.txtID.Tag & "" = "" Then
    
            sSQL = "INSERT INTO recEmpEC(EmployeeID, PrmEngConName, Relationship, PrmPhNumber, [Hm/Cell/Wk], 2ndPhNumber, [2ndHm/Cell/Wk])"
            sSQL = sSQL & " VALUES (" & Me.txtID & ", " & Me.txtPrmEngCon & ", " & Me.cboRel & ", " & Me.txtPrmPhNum & ", " & Me.cboHmCellWk1 & ", " & Me.txtSecPhNum & ", " & Me.cboHmCellWk2 & ")"
    
            'for debugging
    Debug.Print sSQL
    
            CurrentDb.Execute sSQL, dbFailOnError
    
        Else
    
            sSQL = "UPDATE recEmpEC Set EmployeeID = " & Me.txtID & ", PrmEngConName = " & Me.txtPrmEngCon & ", Relationship = " & Me.cboRel & ","
            sSQL = sSQL & " PrmPhNumber = " & Me.txtPrmPhNum & ", [Hm/Cell/Wk] = " & Me.cboHmCellWk1 & ","
            sSQL = sSQL & " 2ndPhNumber = " & Me.txtSecPhNum & ", [2ndHm/Cell/Wk] = " & Me.cboHmCellWk2
            sSQL = sSQL & " WHERE EmployeeID = " & Me.txtID.Tag
    
            'for debugging
    Debug.Print sSQL
    
            CurrentDb.Execute sSQL, dbFailOnError
    
        End If
    
    
        cmdClear_Click
        subfrmEmpEC.Form.Requery
    
    End Sub
    Set a breakpoint and see what the SQL looks like.
    Do you have the correct delimiters??

    Warning: I might have missed something when I retyped this

  5. #5
    johnnyBQue is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Oct 2014
    Posts
    33
    Thanks guys for all your help but I figured it out after letting my eyes rest a bit ...went through the code comparing it to the same code in another form (line for line ....syntax to syntax) and found the I left out a ( ' ) in the "VALUES line I the error was (" & Me.txtID & "," & Me.txt...) the error was in the RED text it should have been (" & Me.txtID & ",'" & Me.txt...) left out the apostrophe.

    thanks again for all the help and quick response... it's working as it should now...

    This post has been resolved....

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

Similar Threads

  1. Replies: 3
    Last Post: 06-27-2014, 01:09 AM
  2. Method or Data member not found error
    By junwatts in forum Access
    Replies: 1
    Last Post: 09-27-2013, 08:49 AM
  3. compile error method or data member not found???
    By chuman vishal in forum Programming
    Replies: 2
    Last Post: 02-26-2013, 01:57 PM
  4. Method or data member not found
    By papa yaw in forum Programming
    Replies: 5
    Last Post: 12-17-2012, 02:19 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