Attachment data type and Control question using VBA

JohnnyBQue

Registered User.
Local time
Today, 05:50
Joined
Oct 31, 2014
Messages
25
New to writing code, and I'm having difficulty figuring out attachments (seems others are too). What I'm looking to do is bring up a set of attachments when performing a search on an employees name or ID. I'm having issues because VB doesn't seem to want to work with attachment controls or fields too well and my ignorance isn't helping. Where I've used (example)

CurrentDb.Execute "UPDATE recEmpJD " & _
" Set EmpID=" & Me.txtID & _
"' HireDate='" & ME,txtHireDate & "'" & _
"' Depart='" & Me.cboDepart & "'" & _

I can't seem to figure out what identifier works for attachment control "att" ?? or am I totally wet and need to address attachments in a different manner? Seems like the attachment control (type) isn't compatible when used in a string with other field/data types.

any suggestion would be take most welcome
 
You're almost there, but no cigar. Try

CurrentDb.Execute "UPDATE recEmpJD " & _
"Set EmpID"=" & Me.txtID & _
",HireDate='" & ME.txtHireDate & "'" & _
",Depart='" & Me.cboDepart & "'';"


If HireDate and Depart are date fields, use a # in the concantenatioon, not a '.

Put the generated SQL string in the QBE SQL window, in the SELECT view and see if it executes, before executing the string in VBA.
 

Users who are viewing this thread

Back
Top Bottom