View Single Post
 
Old 06-15-2011, 09:51 PM
NISMOJim NISMOJim is offline Windows XP Office 2007
Novice
 
Join Date: Jun 2011
Posts: 9
NISMOJim is on a distinguished road
Default

Thanks for the reply. The spaces on the form say {FORMTEXT} (some say {FORMCHECKBOX}, but I never have been able to get those to work. I think that problem was in how to code it in Access VBA).
In normal view, I can right-click on one of the spaces to bring up Properties. That opens a Text Form Field Options window. The bottom half of this window has a Field Settings area. Under Bookmark: is the name given to this field/bookmark (EDate), which led me to believe it was a bookmark and not a Field.
I've look up again how to insert fields on the new form. I clicked Insert, Quick Parts, then Field, but I'm not sure what category to use in this case. The ones I have tried still don't look like what is on the old document. They look more like formulas rather than text from a database. If you have an easily explained method I could use, that would probably help me sooner and with less confusion than the help files.

Thanks again for your response.

Edit:

Here is the code from the Access form that does work if it might help;

Code:
Private Sub ChkYInj_GotFocus()
'If the "Yes" box is checked indicating there was an injury, the Injury Report form opens
Const DOC_PATH As String = "T:\Injury Reporting\"
Const DOC_NAME As String = "Injury Form.doc"
 
Dim appWord As Word.Application
Dim doc As Word.Document
Dim rst As ADODB.Recordset
Dim strSQL As String
On Error Resume Next
Set appWord = GetObject(, "Word.application")
If Err = 429 Then
  Set appWord = New Word.Application
  Err = 0
End If
With appWord
  Set doc = .Documents(DOC_NAME)
  If Err = 0 Then
    If MsgBox("Do you want to save a copy of this form?", vbYesNo) = vbYes Then
      .Dialogs(wdDialogFileSaveAs).Show
    End If
    doc.Close False
  End If
  On Error Goto ErrorHandler
 
  Set doc = .Documents.Open(DOC_PATH & DOC_NAME, , True)
  Set rst = New ADODB.Recordset
 
  With doc
    .FormFields("name").Result = Nz(Forms!Input![J1Name])
    .FormFields("date").Result = Nz(Forms!Input![NDate])
    .FormFields("details").Result = Nz(Forms!Input![NDesc])
  End With
  .Visible = True
  .Activate
End With
Set rst = Nothing
Set doc = Nothing
Set appWord = Nothing
Exit Sub
ErrorHandler:
MsgBox Err & Err.Description
 
End Sub

Last edited by macropod; 06-16-2011 at 04:57 PM. Reason: Added code tags & formatting
Reply With Quote