Importing to a word Bookmark

Lochwood

Registered User.
Local time
Yesterday, 23:08
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, "")
 
Shot in the dark but try

Format(rs!Prov_Job_End, "Long Date")
 
Just to clarify, technically, this is an export rather than an import.
 
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.
 
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.
 
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.
 
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

Back
Top Bottom