merge with an "online form" problem with text box

J

Jessica Jones

I have created an online form that utilizes check boxes, text boxes, and a
combo box. The data source is an excel worksheet. After I merge the data into
the form, I protect the form. None of my text boxes will accept focus. The
check boxes work fine and the combo box works fine.

I will appreciate any help.
Thank you.
 
D

Doug Robbins - Word MVP

Those to features - Mail Merge and Online Forms are not compatible. There
is a work around, but it involves the use of VBA to create a new document
for each record in the data source and getting the information from Excel
and inserting it into each of those new documents.

Are you up to that?
--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP
 
C

Charles Kenyon

Yes, this is how it works. MailMerge and Online forms are mutually
incompatible. If it is protected you can't merge. After you merge, your
fields are gone. Part of this, I'm sure, has to do with using bookmarks for
form fields. Bookmarks are lost in a mailmerge because they need to be
unique.

How many records are you merging into your form?
--
Charles Kenyon

Word New User FAQ & Web Directory: http://addbalance.com/word

Intermediate User's Guide to Microsoft Word (supplemented version of
Microsoft's Legal Users' Guide) http://addbalance.com/usersguide


--------- --------- --------- --------- --------- ---------
This message is posted to a newsgroup. Please post replies
and questions to the newsgroup so that others can learn
from my ignorance and your wisdom.
 
J

Jessica Jones

I am up for trying anything. I have minor VBA and VB experience. Right now,
we have about 25 records that I need to merge.
Taking the information out of one program and using excel really only a sa
middleware to add some more fields to be able to collect some information.
Then, I wanted the online form to save the information as a delimited text
file to be able to import into access.
I know this is a very long way around, most would say, import it into access
directly and use those forms. BUT, the people who will do the data entry are
very afraid of access.

Thanks for your rapid responses. I really appreciate your time. I knew there
had to be a reason my text boxes were misbehaving. Why do the combo boxes and
check boxes still work?
 
C

Charles Kenyon

My guess is that the combo boxes and checkboxes you have working are
inserted using the Controls Toolbox rather than the forms toolbar.

The reason I asked about the number of records is that I use a work-around
for working with a single record, but it won't work with 25. Try Doug's
solution.
--
Charles Kenyon

Word New User FAQ & Web Directory: http://addbalance.com/word

Intermediate User's Guide to Microsoft Word (supplemented version of
Microsoft's Legal Users' Guide) http://addbalance.com/usersguide


--------- --------- --------- --------- --------- ---------
This message is posted to a newsgroup. Please post replies
and questions to the newsgroup so that others can learn
from my ignorance and your wisdom.
 
D

Doug Robbins - Word MVP

Rather than having to have the macro interact with Excel, it will be easier
if you create a Catalog (or in Word XP and later, it is called "Directory")
type mailmerge main document in which you have a one row table into the
cells of which you insert the mergefields from your Excel datasource. When
you execute that merge to a new document, that document will contain a table
with a row of data for each record in the datasource. In the code below, it
is assumed that you save that document as C:\Documents and Settings\[User
Name]\My Documents\My Data Sources\DataDoc.doc").

Now you need to create or save your form as a template and inplace of
mergefields in that template, insert { DOCVARIABLE varname } fields. In the
code below, it is assumed that those fields are named var1, var2, ... varj
where you will have the
{ DOCVARIABLE var1 } field in the location where the data from the first
column of the table in the document that you saved as DataDoc is required
and the { DOCVARIABLE var2 } field in the location where the data from the
second column of the table is required, and so on for each field in the
datasource. Protect the template for Forms and then save and close it and
also the DataDoc document.

Now when you run the following macro, it will create a new document from the
template for each record in the datasource, with the data from each record
in the datasource inserted into it. Each of those documents will be saved
with the filename myformdoc1, myformdoc2, etc, but you can have the newdoc
in the filename replaced by anything else that you might want to use by
inserting whatever that is in the line "newdoc.SaveAs "myformdoc" & i"
in place of the myformdoc.

Dim datasource As Document, newdoc As Document, datarange As Range, i As
Long, j As Long, datatable As Table
Set datasource = Documents.Open("C:\Documents and Settings\[User Name]\My
Documents\My Data _ Sources\DataDoc.doc")
Set datatable = datasource.Tables(1)
For i = 1 To datasource.Tables(1).Rows.Count
Set newdoc = Documents.Add("C:\Documents and Settings\Doug
Robbins\Application _ Data\Microsoft\Templates\DataForm.dot")
For j = 1 To datatable.Columns.Count
Set datarange = datatable.Cell(i, j).Range
datarange.End = datarange.End - 1
newdoc.Variables("varj").Value = datarange.Text
Next j
newdoc.Fields.Update
newdoc.SaveAs "myformdoc" & i
newdoc.Close
Next i


--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP
 
J

Jessica Jones

Good Monday Morning!

Just to keep the information correct, I wanted to respond to and state that
I definitely used the forms toobar and not the Controls toolbox with the
checkboxes and combo box. That is really what has me so frustrated.

Thanks Charles!
 
C

Charles Kenyon

The Forms toolbar does not have combo boxes! It has drop downs.
--
Charles Kenyon

Word New User FAQ & Web Directory: http://addbalance.com/word

Intermediate User's Guide to Microsoft Word (supplemented version of
Microsoft's Legal Users' Guide) http://addbalance.com/usersguide


--------- --------- --------- --------- --------- ---------
This message is posted to a newsgroup. Please post replies
and questions to the newsgroup so that others can learn
from my ignorance and your wisdom.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top