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