hi guys, this is the situation
I have a form where the user enter data.
I would like to let the user press a preview button and open a word doc containing the info entered in the form.
I created the doc and insert all the necessary fields coming from 3 different tables (wine,supplier and pop)
Code in the preview button:
problems:
1- if i create the word as a DOC instead of a DOT an error comes saying that the file con not be open. Why?
2- if i create the word as a DOT i can not open it 'cos a msg appears asking if i want to run an sql to populate the document. how can avoid it?
3- i would like to open the word with the info coming from the form. How can i do it?
thx very much, max.
I have a form where the user enter data.
I would like to let the user press a preview button and open a word doc containing the info entered in the form.
I created the doc and insert all the necessary fields coming from 3 different tables (wine,supplier and pop)
Code in the preview button:
Code:
Dim objword As Object
Set objword = CreateObject("word.application")
Dim strSaveAs As String
Dim strPath As String
Dim strContract As String
strPath = "S:\qf_qantas\wine\"
strSaveAs = Me.ifsnumber & Date & ".doc"
If IsNull(DLookup("ifsnumber", "pop", "ifsnumber=" & Me.ifsnumber & "")) Then
MsgBox "You must save the POP first."
Else
Application.FollowHyperlink "W:\Documents and Settings\mdaniel\Application Data\Microsoft\Templates\QANTAS AIRWAYS.dot"
'objword.ActiveDocument.SaveAs FileName:=strPath & strSaveAs
End If
problems:
1- if i create the word as a DOC instead of a DOT an error comes saying that the file con not be open. Why?
2- if i create the word as a DOT i can not open it 'cos a msg appears asking if i want to run an sql to populate the document. how can avoid it?
3- i would like to open the word with the info coming from the form. How can i do it?
thx very much, max.