Blank Date Field in Merge

S

Steve 96

Hi:
In office XP, I'm merging from an Access table to Word. I have a date field
in my database that is sometimes left blank. When I merge, Word puts in the
correct date when there is a date shown in the database, but also puts in a
default date when the field is blank. How can I make this remain blank in my
merge document, and show the date only when one has been entered in my Acces
database? I'm guessing there's way by pressing alt+F9 in the document...
Also, I'm working with databases and Word docs that were originally created
(and worked properly) in an older version of office, on windows 98...now
using XP, not sure if that's part of the issue.
MUCH THANKS!
 
P

Peter Jamieson

As ong as the default date never actually appears in your data,
a. use { MERGEFIELD thedatefield } to discover what Word inserts when the
date is blank. Suppose it is

01/01/1900 00:00:00

Then use a nested field like

{ IF "{ MERGEFIELD thedatefield }" = "01/01/1900 00:00:00" "" "{ MERGEFIELD
thedatefield }" }

All the {} have to be the special field code braces that you can insert
using ctrl-F9
 
S

Steve 96

Thanks Peter, but I'm afraid I still need some clarification.
To give you some add'l info:
The date fields, if left blank in the database, are defaulting to TODAY's
date in my Word doc.
Pressing alt+F9 reveals this:
{MERGEFIELD BalDate\@ "MM/dd/yyyy"}
or similar...
I'm sorta new to working with these little codes, and have no experience w/
"nested" files...
Any add'l detailed advice is MUCH appreciated.
Thanks for your time & expertise!
S
 
P

Peter Jamieson

1. OK, it seems likely to me that your Access application is storing today's
date when the user enters blank. Well, that is one possibility.

2. To work with the merge fields, use ctrl-F9 to insert each pair of the
special field braces {}. Everything else is ordinary text, so you insert the
pairs of {} you need and fill the rest in by typing in the usual way. Use
Alt-F9 to toggle between "field code" and "field result" view. Use F9 to
update selected fields.

3. There are various possible scenarios here.

4. If BallDate is today (In Access),
a. do you want to display a BallDate of today?
b. or blank?

If it's (a), we can do

{ IF { MERGEFIELD BallDate \@YYYYMMDD } = { DATE \@YYYYMMDD } "" "{
MERGEFIELD BallDate \@"MM/dd/yyyy" }" }


5. Otherwise, either there has to be some way for Word to distinguish
between a blank date and today's date. For example, if you enter the field

{ MERGEFIELD BallDate \@hhmmss }

what does Word show when
a. the date in Access is blank
b. the date in Access is today's date?

If Word always shows e.g. 000000 when the date has been entered as blank,
but a real hours, minutes, seconds value otherwise, then you could consider
using e.g.

{ IF { MERGEFIELD BallDate \@hhmmss } = "000000" "" "{ MERGEFIELD BallDate
\@"MM/dd/yyyy" }" }

(for example, BallDate might happen to capture the time as at the moment the
user entered the data or some such - it depends on how the Access
application works. But there is obvious always a chance that you will
"accidentally" get the same value as Access inserts for "blank", and someone
might change the application code in a way that would stop this approach
working.

6. Otherwise, you probably need to create a query that works out the text
that you need in Word. if you are in a position to create an Access query,
you can consider doing it that way. If not, you could probably use a small
piece of Word VBA to do the same thing. However, again, it depends on
whether the /query/ can tell the difference between a blank date and today's
date.
 

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