ChrisLayfield
Registered User.
- Local time
- Today, 11:09
- Joined
- May 11, 2010
- Messages
- 55
I have been trying to have a form that would push data from Access to a Word document with bookmarks. (I would make a report, but the forms are controlled by the government.)
On the form the user selects the ProjectID (displayed as the project name on form) and I need to export the project name to the word document. I thought the SQL coded here would work, but it apparently finds nothing and ends the routing at that code. Can anyone indicate why this is failing? When I put a code break on the set rstProjName line, everything is =Nothing.
On the form the user selects the ProjectID (displayed as the project name on form) and I need to export the project name to the word document. I thought the SQL coded here would work, but it apparently finds nothing and ends the routing at that code. Can anyone indicate why this is failing? When I put a code break on the set rstProjName line, everything is =Nothing.
Code:
Function OpenIncidentReport()
Dim wrdApp As Object
Dim dbs As Database
Dim rstProjName As Recordset
Set dbs = CurrentDb
Set rstProjName = dbs.OpenRecordset("SELECT ProjectName " & _
"FROM tbl_NCS_Projects " & _
"WHERE frmIncidentReport.ProjectID = '" & tbl_NCS_Projects.ProjectID & "';")
MsgBox rstProjName