Hi,
Any help would be really appreciated.![[smile] [smile] [smile]](/data/assets/smilies/smile.gif)
The problem is this:
I can output to an rtf file and give it a static name;
The user clicks on the combo box (combo0) and chooses a reference value which is generated with the field: REFVAL from the Query (AllDetailsCard)
The Query (ChsRef) (with the field REFVAL, which has the criteria [Forms]![ChsRef].[Combo0]) then takes the input and generates the Report (HcnyCrgDri)
- which does not display but is used to create the rtf file.
As the code on my Form (ChsRef) cmd button below demonstrates I can output to a statically named rtf file:
What I want to do is use the Field: REFVAL in the Query: ChsRef to name the file when it is generated;
So it will have field REFVAL.rtf as the filename therefore not a static filename.
I have tried the following code:
BUT I get this error:
If I add
It just names it with the exact above string.
I'm banging my head on this one;![[banghead] [banghead] [banghead]](/data/assets/smilies/banghead.gif)
Your help would really be great!![[smile] [smile] [smile]](/data/assets/smilies/smile.gif)
Thank you![[bigsmile] [bigsmile] [bigsmile]](/data/assets/smilies/bigsmile.gif)
Kind regards
Triacona
Any help would be really appreciated.
![[smile] [smile] [smile]](/data/assets/smilies/smile.gif)
The problem is this:
I can output to an rtf file and give it a static name;
The user clicks on the combo box (combo0) and chooses a reference value which is generated with the field: REFVAL from the Query (AllDetailsCard)
The Query (ChsRef) (with the field REFVAL, which has the criteria [Forms]![ChsRef].[Combo0]) then takes the input and generates the Report (HcnyCrgDri)
- which does not display but is used to create the rtf file.
As the code on my Form (ChsRef) cmd button below demonstrates I can output to a statically named rtf file:
Code:
Private Sub HnkyCrDriCrd_Click()
On Error GoTo Err_HnkyCrDriCrd_Click
Dim stDocName As String
stDocName = "HcnyCrgDri"
DoCmd.OutputTo acOutputReport, stDocName, acFormatRTF, "Hackney Carriage License.rtf"
Exit_HnkyCrDriCrd_Click:
Exit Sub
Err_HnkyCrDriCrd_Click:
MsgBox Err.Description
Resume Exit_HnkyCrDriCrd_Click
End Sub
So it will have field REFVAL.rtf as the filename therefore not a static filename.
I have tried the following code:
Code:
Private Sub HnkyCrDriCrd_Click()
On Error GoTo Err_HnkyCrDriCrd_Click
Dim stDocName As String
stDocName = "HcnyCrgDri"
DoCmd.OutputTo acOutputReport, stDocName, acFormatRTF, [COLOR=red yellow][Forms]![ChsRef].[Combo0][/color]
Exit_HnkyCrDriCrd_Click:
Exit Sub
Err_HnkyCrDriCrd_Click:
MsgBox Err.Description
Resume Exit_HnkyCrDriCrd_Click
End Sub
If I put:Microsoft Office Access can't save the data to the file you've selected
Code:
Private Sub HnkyCrDriCrd_Click()
On Error GoTo Err_HnkyCrDriCrd_Click
Dim stDocName As String
stDocName = "HcnyCrgDri"
DoCmd.OutputTo acOutputReport, stDocName, acFormatRTF, [Forms]![ChsRef].[Combo0][COLOR=red yellow].rtf[/color]
Exit_HnkyCrDriCrd_Click:
Exit Sub
Err_HnkyCrDriCrd_Click:
MsgBox Err.Description
Resume Exit_HnkyCrDriCrd_Click
End Sub
Object doesn't support this property or method
If I add
Code:
DoCmd.OutputTo acOutputReport, stDocName, acFormatRTF, "[Forms]![ChsRef].[Combo0].rtf"
I'm banging my head on this one;
![[banghead] [banghead] [banghead]](/data/assets/smilies/banghead.gif)
Your help would really be great!
![[smile] [smile] [smile]](/data/assets/smilies/smile.gif)
Thank you
![[bigsmile] [bigsmile] [bigsmile]](/data/assets/smilies/bigsmile.gif)
Kind regards
Triacona