Results 1 to 9 of 9
  1. #1
    91hrdbdy is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Nov 2013
    Posts
    3

    in Way over my head HELP

    Hello every one Im totaly up the creek with out a paddle here. my mouth wrote a check my ass cant cash. I have a form made in access and i need it to output data to a word form that we submit to the FEMA. i dont know where i messed up i followed the tutorial here http://www.techrepublic.com/blog/mic...h-access-data/



    From what i understand when i press the command button titled elevation forum it should open word and then open the file elevation-forum.doc and then fill in the information i listed in the "with" section of the vba code. it does none of this. lol here is the code i listed.

    Code:
    Private Sub cmdPrint_Click()
       'Print customer slip for current customer.
        Dim appWord As Word.Application
       Dim doc As Word.Document
       'Avoid error 429, when Word isn't open.
       On Error Resume Next
       Err.Clear
       
       'Set appWord object variable to running instance of Word.
       Set appWord = GetObject(, "Word.Application")
       If Err.Number <> 0 Then
          'If Word isn't open, create a new instance of Word.
          Set appWord = New Word.Application
       End If
       
       Set doc = appWord.Documents.Open("C:\Users\Clint\Desktop\flood cert files\ELEVATION-FORM.doc", , True)
       
       With doc
          .FormFields("fldADDRESS").Result = Me!Address
          .FormFields("fldCITY").Result = Me!City
          .FormFields("fldSTATE").Result = Me!State
          .FormFields("fldZIP").Result = Me!Zip
          .FormFields("fldBFE").Result = Me!BFE
          .FormFields("fldLAT").Result = Me!Lat
          .FormFields("fldLONG").Result = Me!Lon
          .Visible = True
          .Activate
       End With
       
       Set doc = Nothing
       Set appWord = Nothing
       Exit Sub
    errHandler:
       MsgBox Err.Number & ": " & Err.Description
    End Sub
    
    Private Sub Command616_Click()
    End Sub
    any help would be great. Ill paypal someone if they can help me out here.
    Last edited by RuralGuy; 11-25-2013 at 05:20 PM. Reason: Addes code tags and formatting

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,902
    Are you absolutely POSITIVE this has to go to Word and can't use an Access report object?

    That article is for pre-Access 2007 versions. You are using Access 2010. How did you prepare Word document to be a form by following that article?

    Access/Word merge can be setup with either app by using wizards.

    http://office.microsoft.com/en-us/ac...in=HA010285219

    http://office.microsoft.com/en-us/wo...101857701.aspx
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows XP Access 2003
    Join Date
    Aug 2013
    Posts
    7,862
    I have never used form fields in Word but there does not seem to be anything jumping out at me. What happens if you remove "On Error Resume Next"?

    It would be nice to know where it is not working.

  4. #4
    91hrdbdy is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Nov 2013
    Posts
    3
    it has to go to word because its a standardized document we have to mail to FEMA i posted the word document here https://skydrive.live.com/redir?resi...nt=file%2c.doc

    the command button does not function when i press it.

  5. #5
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows XP Access 2003
    Join Date
    Aug 2013
    Posts
    7,862
    I understand the part where you need to use a standardized form.

    What happens if you remove "On Error Resume Next"? Does it help to show you where exactly the error is occurring? Stating, "It doesn't work.", does not give much to go on.

  6. #6
    NTC is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    Nov 2009
    Posts
    2,392
    May I ask why not consider a simple Word merge set up?

  7. #7
    91hrdbdy is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Nov 2013
    Posts
    3
    here is my office limitations we have some real non computer savy people here and we are filling out 3 and 4 forms per job all with the same information in them and we keep having typos so my boss tasked my with comming up with a way to fill out these forms with a single click. so my plan was to have three buttons on the top of the access forum where a user can fill out the forum save it to the database and then print the necessary forms. but here is the catch every job we do get its own folder on the server. So my thought was to have it output to a word doc where the user can then save as and save it to the proper job folder. here is the error i get when i click the button
    as far as mail merge im not sure what that is?

  8. #8
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows XP Access 2003
    Join Date
    Aug 2013
    Posts
    7,862
    Have you added "Microsoft Word XX.X Object Library" to your references?

    In you VBA IDE go to Tools>References

  9. #9
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,902
    Mail merge is described in the two links provided in post 2.

    Recreating that form in Access not impossible, just challenging.

    I have one form reproduced in Access by using a jpg of the form as background to data textboxes.

    It is also possible to use Access VBA to populate a form-fill PDF.

    Do you want to programmatically fill in the table of property data that starts on page 1 and continues through page 2? That definitely won't be easy with Word or PDF.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Head Scratcher.
    By Shido151 in forum Access
    Replies: 1
    Last Post: 04-03-2012, 01:25 PM
  2. Get column head name from list box?
    By joelmeaders in forum Programming
    Replies: 3
    Last Post: 01-31-2012, 11:23 AM
  3. In over my head with Linked Tables!!
    By Chedmeister in forum Access
    Replies: 6
    Last Post: 01-31-2012, 03:04 AM
  4. Noob in way over his head, pls help
    By custhasno in forum Access
    Replies: 8
    Last Post: 10-12-2011, 02:33 AM
  5. In over my head
    By TylerB in forum Access
    Replies: 2
    Last Post: 05-04-2011, 04:07 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums