Importing to a word Bookmark (1 Viewer)

Lochwood

Registered User.
Local time
Yesterday, 23:49
Joined
Jun 7, 2017
Messages
130
I have a query data that imports into a word template using bookmarks.

What would the syntax be to import date field as long date.. currently defaulting to general date on the word doc but long date on the query.

WDoc.Bookmarks("Client").Range.Text = Nz(rs!Client, "")
WDoc.Bookmarks("Location").Range.Text = Nz(rs!Location, "")
WDoc.Bookmarks("StartDate").Range.Text = Nz(rs!Act_Job_Start, "")
WDoc.Bookmarks("StartTime").Range.Text = Nz(rs!Mob_Start_Time, "")
WDoc.Bookmarks("ReportTo").Range.Text = Nz(rs!Mob_Report_To, "")
WDoc.Bookmarks("SiteContact").Range.Text = Nz(rs!Mob_Site_Contact, "")
WDoc.Bookmarks("HrsPerDay").Range.Text = Nz(rs!Mob_Hrs_Per_Day, "")
WDoc.Bookmarks("HrsPerWeek").Range.Text = Nz(rs!Mob_Hrs_Per_Week, "")
WDoc.Bookmarks("ProvEnd").Range.Text = Nz(rs!Prov_Job_End, "")
 

pbaldy

Wino Moderator
Staff member
Local time
Yesterday, 23:49
Joined
Aug 30, 2003
Messages
36,125
Shot in the dark but try

Format(rs!Prov_Job_End, "Long Date")
 

Pat Hartman

Super Moderator
Staff member
Local time
Today, 02:49
Joined
Feb 19, 2002
Messages
43,266
Just to clarify, technically, this is an export rather than an import.
 

pbaldy

Wino Moderator
Staff member
Local time
Yesterday, 23:49
Joined
Aug 30, 2003
Messages
36,125
May be a stab in the dark but it worked a treat.. :)

Well, I guess it untested in your situation more than a shot in the dark. ;)

Glad it worked for you.
 

Pat Hartman

Super Moderator
Staff member
Local time
Today, 02:49
Joined
Feb 19, 2002
Messages
43,266
I'm pretty sure Paul that baring any typos, this would work:)

Personally, whenever I work with word automation, I feel like I am playing pin the tail on the donkey. I'm flailing around in the dark trying to hit some target I can't actually see.
 

pbaldy

Wino Moderator
Staff member
Local time
Yesterday, 23:49
Joined
Aug 30, 2003
Messages
36,125
Yeah, I've done some Word automation, but I'm more comfortable converting it to an Access report, even though it may be more work at the beginning. I assumed it was just a lack of familiarity on my part. I automate Excel much more.
 

Pat Hartman

Super Moderator
Staff member
Local time
Today, 02:49
Joined
Feb 19, 2002
Messages
43,266
Excel makes sense to automate since the objects are more familiar to us. I have done a lot of work with populating bookmarks in Word documents but not much with formatting or building documents on the fly.
 

Users who are viewing this thread

Top Bottom