Results 1 to 6 of 6

Hit Statement & Syntax Wall

  1. #1
    Soule is offline Advanced Beginner
    Windows Vista Access 2007
    Join Date
    Dec 2011
    Posts
    58

    Hit Statement & Syntax Wall

    Hi, Everyone,
    A little fire to put out --

    I'm trying to simply populate 5 fields in a table from the same-named 5 controls on a form with vb OnButtonClick(). Four of the controls are sourced to another table, and one of them us unbound. My code is in an .accdb file in Access 2007. I have no ADO library ref. specified. Should I?

    I'm getting my first error ("type mismatch") on the SELECT line. Here it is as it sits...

    Code:
     
    ' This final procedure copies the data in the "FirstName", "LastName", "KnownAs", "Title" and "DidEmployeeDownload" form
    ' controls to same named fields in "A1 Movie Code Table".
     
    On Error GoTo PROC_ERR
    Dim db As Database
    Dim rs As Recordset
     
    Set db = CurrentDb
    Set rs = db.OpenRecordset("A1S1 Movie Code Table", dbOpenDynaset)
    Set db = ("SELECT Forms.A1S1 Onboarding Tracking Form.[FirstName].Value, Forms.A1S1 Onboarding Tracking Form.[LastName].Value, Forms.A1S1 Onboarding Tracking 
    Form.[KnownAs].Value, Forms.A1S1 Onboarding Tracking Form.[Title].Value, Forms.A1S1 Onboarding Tracking Form.[DidEmployeeDownload].Value FROM [A1S1 
    Onboarding Tracking Form]")
     
     
    rs![FirstName] = Forms.A1S1 Onboarding Tracking Form.[FirstName].Value
    rs![LastName] = Forms.A1S1 Onboarding Tracking Form.[LastName].Value
    rs![KnownAs] = Forms.A1S1 Onboarding Tracking Form.[KnownAs].Value
    rs![Title] = Forms.A1S1 Onboarding Tracking Form.[Title].Value
    rs![DidEmployeeDownload] = Forms.A1S1 Onboarding Tracking Form.[DidEmployeeDownload].Value
     
    rs.Close
     
    Debug.Print ("Populate used movie code recipient info. to movie code table")
     
    PROC_EXIT:
    Set rs = Nothing
    Set db = Nothing
    Exit Sub
     
    PROC_ERR:
    MsgBox "Error populating used movie code recipient info. to movie code table." & vbCrLf & Err.Number & Err.Description, vbExclamation + vbOKOnly, "Populate Table Next Movie Code To Form Control"
     
    Resume PROC_EXIT
    Should I not be calling the table in the db.OpenRecordset set statement? Is its syntax right?
    What is wrong with my Set db/SELECT line? Are they incompatible statements together?
    I feel like I'm close but am missing something here in my Set and rs! lines.

    This post also resides at:
    http://www.utteraccess.com/forum/Hit...d#entry2199673


    http://www.access-programmers.co.uk/...d.php?t=220794
    http://bytes.com/topic/access/answer...-type-mismatch

    Any input will be appreciated. Thank you.

    Frank
    Last edited by Soule; 01-17-2012 at 03:47 PM. Reason: Cross posting references.

  2. #2
    orange's Avatar
    orange is online now Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    14,330
    It is poor etiquette to double post

    http://www.utteraccess.com/forum/Hit...-t1980652.html

  3. #3
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    48,359
    Unless you inform us of the other posts and provide the links.
    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
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    20,719
    Quote Originally Posted by orange View Post
    It is poor etiquette to double post
    Is triple okay?

    http://www.access-programmers.co.uk/...d.php?t=220794

    More info Soule:

    cross posters
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  5. #5
    orange's Avatar
    orange is online now Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    14,330
    That cross posters a good link Paul.
    You must have sw to scan all forums for replicates.....

  6. #6
    Soule is offline Advanced Beginner
    Windows Vista Access 2007
    Join Date
    Dec 2011
    Posts
    58
    Ooopa. Problem fixed.

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

Similar Threads

  1. Replies: 7
    Last Post: 08-17-2011, 01:49 PM
  2. UPDATE Statement Correct Syntax
    By OMGsh Y did I say Yes in forum Forms
    Replies: 2
    Last Post: 02-23-2011, 01:42 PM
  3. Case Statement Syntax
    By allenjasonbrown@gmail.com in forum Programming
    Replies: 1
    Last Post: 11-16-2010, 07:18 PM
  4. IIf Statement Syntax Error
    By shexe in forum Queries
    Replies: 2
    Last Post: 10-06-2010, 08:35 AM
  5. Select statement syntax?
    By ksmith in forum Programming
    Replies: 3
    Last Post: 06-24-2010, 09:21 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
  •  
Tech Forums: Microsoft Office Forums