hello,
I hope you can help me with this problem. I'am making a bookmark with acces to word with VBA. The problem is that the client want's a autonumber with this style yyyy-1000
yyyy represents the year en 1000 must be upwards with 1.
This is the code i'am using so far:
Private Sub faxsturen2_Click()
On Error GoTo Err_faxsturen2_Click
DoCmd.RunSQL "INSERT INTO faxgeschiedenis (faxnr, bedrijfsid, bedrijfinstelling, inlognaam, datumtijd, [korteomschrijving])VALUES (fax, bedrijfsid, bedrijfinstelling, FOSusername(), now(), [typ hieronder kort de inhoud van de FAX])"
Dim dbs As DAO.Database
Dim rstMergeThese As Recordset
Dim oApp As Object
Set oApp = CreateObject("Word.Application"
oApp.Visible = True
datum = Format(Date, jjjj)
With oApp
.Documents.Open "C:\5-11-20031\faxbericht.dot"
' Move to each bookmark and insert text from the form.
.activedocument.bookmarks("bedrijfinstelling".SELECT
.selection.Text = (CStr(Forms!dhsleads!BedrijfInstelling))
.activedocument.bookmarks("TAV".SELECT
.selection.Text = (CStr(Forms!dhsleads!Lead))
.activedocument.bookmarks("faxnr".SELECT
.selection.Text = (CStr(Forms!dhsleads!Fax))
.activedocument.bookmarks("datumtijd".SELECT
.selection.Text = Now()
.activedocument.bookmarks ("datum"
.selection.tekt = datum()
'if word isn't running, start and activate it
If Err Then
Shell "C:\Program Files\Microsoft Office\Office\" & "WinWord / Automation", vbMaximizedFocus
AppActivate "Microsoft Word"
End If
End With
Exit_faxsturen2_Click:
Exit Sub
Err_faxsturen2_Click:
MsgBox "Als u een fax wilt sturen is een korte omschrijving verplicht"
Resume Exit_faxsturen2_Click
End Sub
I hope you can help me!
Best regards,
Ruud Harreman
ps. sorry for my bad english. I'am from the netherlands i hope that explain something ;-)
I hope you can help me with this problem. I'am making a bookmark with acces to word with VBA. The problem is that the client want's a autonumber with this style yyyy-1000
yyyy represents the year en 1000 must be upwards with 1.
This is the code i'am using so far:
Private Sub faxsturen2_Click()
On Error GoTo Err_faxsturen2_Click
DoCmd.RunSQL "INSERT INTO faxgeschiedenis (faxnr, bedrijfsid, bedrijfinstelling, inlognaam, datumtijd, [korteomschrijving])VALUES (fax, bedrijfsid, bedrijfinstelling, FOSusername(), now(), [typ hieronder kort de inhoud van de FAX])"
Dim dbs As DAO.Database
Dim rstMergeThese As Recordset
Dim oApp As Object
Set oApp = CreateObject("Word.Application"
oApp.Visible = True
datum = Format(Date, jjjj)
With oApp
.Documents.Open "C:\5-11-20031\faxbericht.dot"
' Move to each bookmark and insert text from the form.
.activedocument.bookmarks("bedrijfinstelling".SELECT
.selection.Text = (CStr(Forms!dhsleads!BedrijfInstelling))
.activedocument.bookmarks("TAV".SELECT
.selection.Text = (CStr(Forms!dhsleads!Lead))
.activedocument.bookmarks("faxnr".SELECT
.selection.Text = (CStr(Forms!dhsleads!Fax))
.activedocument.bookmarks("datumtijd".SELECT
.selection.Text = Now()
.activedocument.bookmarks ("datum"
.selection.tekt = datum()
'if word isn't running, start and activate it
If Err Then
Shell "C:\Program Files\Microsoft Office\Office\" & "WinWord / Automation", vbMaximizedFocus
AppActivate "Microsoft Word"
End If
End With
Exit_faxsturen2_Click:
Exit Sub
Err_faxsturen2_Click:
MsgBox "Als u een fax wilt sturen is een korte omschrijving verplicht"
Resume Exit_faxsturen2_Click
End Sub
I hope you can help me!
Best regards,
Ruud Harreman
ps. sorry for my bad english. I'am from the netherlands i hope that explain something ;-)