Re: Bookmark REF Field by macropod
macropod
Thu Jul 17 21:50:09 PDT 2008
Hi Eric,
In that case, Try this:
. Create a formfield, with a bookmark named 'Report_ID', set its type to 'calculation' and delete the '=' from the 'expression'.
. Click OK
. Select the formfield and press Shift-F9 to expose its coding, which should look like:
{ FORMTEXT { }}
. Within the field in the formfield, insert three new fields (using Ctrl-F9), so that you get a structure looking like:
{ FORMTEXT { { }{ }{ }}}
. Fill in/around the field braces so that you end up with coding that looks like:
{ FORMTEXT {QUOTE"{REF UserInitials}{REF FiscalYear}{REF State}"}}
. Lock & use your form.
Now that the 'Report_ID' is managed via a formfield, I expect it will behave the same way as your other formfields.
FWIW, a simpler way to achieve the same outcome given your present document, would be to rename the bookmark created by the SET
field (eg to 'Rpt_ID) and change the { FORMTEXT { }} code to { FORMTEXT {REF Rpt_ID}}.
--
Cheers
macropod
[MVP - Microsoft Word]
"Eric" <Eric@discussions.microsoft.com> wrote in message news:7766C1CE-87AF-46D0-8C20-E5834A3052BE@microsoft.com...
> Ok Macropod..... we are getting closer. I understand everything that you
> said. But here is what I meant.
>
> All of the form fields UserInitials, FiscalYear etc are being filled out and
> as expected the Review_ID is automatically filled in. That part works
> wonders. And the {REF Report_ID} shows the Report_ID in that field. But for
> some reason when I export all bookmarked fields to the Access DBase......
> Report_ID does not exist. Evan though the {SET Report_ID proceeds the other
> REF fields. All of the other bookmarked fields are User Form Fields and they
> export just fine. But I'm thinking because the Report_ID field is not a User
> Form Field, rather a REF Field..... that it will not export..... evan if it
> is a bookmark. Here is the bookmarked Report_ID REF Field that I am useing.
>
> {SET Report_ID "{REF State}{REF FiscalYear}{REF UserInitials}{REF Report_ID}
>
> This works great for developing the Report_ID, but will not export as a
> Bookmark to Access.
>
> Got another Idea or a fix? Thanks you've been a great help!
> --
> Eric the Rookie
>
>
> "macropod" wrote:
>
>> Hi Eric,
>>
>> The bookmark will be nothing more than a seies of spaces until at least one of the fields 'FiscalYear', 'UserInitials' and
>> 'State'
>> have been populated. Also, while you can extract formfield text with ".Result", you need to use ".Range.Text" to get a normal
>> bookmark's text.
>>
>> Give the following a try. It outputs a list of all visible bookmarks and their text at the end of the document (naturally, the
>> document will have to be unprotected for this to work):
>>
>> Sub ListBkMrks()
>> Dim oBkMrk As Bookmark
>> If ActiveDocument.Bookmarks.Count > 0 Then
>> With Selection
>> .EndKey Unit:=wdStory
>> .TypeText Text:=vbCrLf & "Bookmark" & vbTab & "Contents"
>> For Each oBkMrk In ActiveDocument.Bookmarks
>> .TypeText Text:=vbCrLf & oBkMrk.Name & vbTab & oBkMrk.Range.Text
>> Next oBkMrk
>> End With
>> End If
>> End Sub
>>
>> If the fields are populated, you'll get an output like:
>> Bookmark Contents
>> FiscalYear FORMTEXT 2008
>> Report_ID PE2008ACT
>> State FORMTEXT AB
>> UserInitials FORMTEXT ME
>> As you can see, the bookmarks are listed in alpha order and the formfields include 'FORMTEXT' as part of the bookmark text, but
>> the
>> Report_ID doesn't.
>>
>> --
>> Cheers
>> macropod
>> [MVP - Microsoft Word]
>>
>>
>> "Eric" <Eric@discussions.microsoft.com> wrote in message news:ED185395-FEA2-4B36-A269-F5BBFACBB126@microsoft.com...
>> > Macropod, I am successfully using:
>> >
>> > {SET Report_ID "{REF UserInitials}{REF FiscalYear}{REF State}"}{REF Report_ID}
>> >
>> > But this bookmark is also being exported out to an access database.
>> > Unfortunately this field is not being exported. Would you know why?
>> > --
>> > Eric the Rookie
>> >
>> >
>> > "Eric" wrote:
>> >
>> >> I got it! I got it! Thanks Mac..... That worked great!
>> >> --
>> >> Eric the Rookie
>> >>
>> >>
>> >> "Eric" wrote:
>> >>
>> >> > Thanks Macropod...... OK where to I paste these to try them? Do I create a
>> >> > Bookmark and us them in the formula or what. The Review ID must be a
>> >> > bookmark because it gets extracted to a database.
>> >> >
>> >> > Thanks for the help
>> >> > --
>> >> > Eric the Rookie
>> >> >
>> >> >
>> >> > "macropod" wrote:
>> >> >
>> >> > > Hi Eric,
>> >> > >
>> >> > > Any particular reason for using a formfield rather than just three REF fields? For example:
>> >> > > {REF UserInitials}{REF FiscalYear)(REFState}
>> >> > > or, if you need to incorporate them into a bookmark:
>> >> > > {SET Report_ID "{REF UserInitials}{REF FiscalYear}{REF State}"}
>> >> > > and to do both that and display the Report ID:
>> >> > > {SET Report_ID "{REF UserInitials}{REF FiscalYear}{REF State}"}{REF Report_ID}
>> >> > >
>> >> > > --
>> >> > > Cheers
>> >> > > macropod
>> >> > > [MVP - Microsoft Word]
>> >> > >
>> >> > >
>> >> > > "Eric" <Eric@discussions.microsoft.com> wrote in message news:481A43AA-B76F-4F88-BD09-56AEE460C6A0@microsoft.com...
>> >> > > >I have a template with several Form Fields. I would like to put in a
>> >> > > > FormField that is automatically filled in with data that comes form three
>> >> > > > other bookmarks. this FormField is a Report ID. The Report ID would be made
>> >> > > > up from three different Bookmarks/Fields that the user fills in, such as
>> >> > > > UserInitials, FiscalYear and State. The Review ID would automatically update
>> >> > > > to ELB2008CA after the user enters the data for UserInitials, FiscalYear and
>> >> > > > State.
>> >> > > >
>> >> > > > Does anyone know how I could do this?
>> >> > > >
>> >> > > > Thanks
>> >> > > > --
>> >> > > > Eric the Rookie
>> >> > >
>>
>>