Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 06-15-2011, 09:51 PM
NISMOJim NISMOJim is offline Write to document from Access form Windows XP Write to document from Access form Office 2007
Novice
Write to document from Access form
 
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
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
Write to document from Access form Microsoft Access 2010 Error open a Web Form WilfredoMolina Office 1 10-10-2010 06:47 AM
Can you actually write HTML and CSS in a word document and send it as an html page jackaroo Word 0 07-12-2010 07:49 AM
Create a Custome Form and export data to Access ashleybyrdnc Office 0 03-05-2010 09:41 AM
Can I fill in Word document from Access table and/or query? slim_jim_56 Word Tables 0 10-03-2007 01:59 PM
Microsoft Access - Form For Sales Analysis kennyharrill Office 0 09-15-2005 08:49 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 02:15 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft