|
本帖最后由 roych 于 2013-2-5 15:48 编辑
上个星期说要发的年终奖,这个星期没发,Access罢工抗议了吧?
附件稍微看了下,请注意特殊字符(这里只是把斜杠【/】替换为短划线【-】,如果还有其他特殊字符,最好用数据有效性或者正则表达式来禁止用户输入,保证数据合法性):- Private Sub Command564_Click()
- On Error GoTo Err_Command564_Click
- Dim filename As String
- Me.Refresh
- Me.Requery
- If IsNull(Me.[Ctr no/Ref no].Value) = True Then
- filename = CurrentProject.Path & "" & "sales" & ".pdf" 'if the contro is null,the file nanme is sales
- Else
- filename = CurrentProject.Path & "" & Replace(Me.[Ctr no/Ref no].Value, "/", "-") & ".pdf" 'use the ctr no as file name and save it in current file
- End If
- DoCmd.OutputTo acOutputForm, "sales", acFormatPDF, filename, True, "", 0
- Me.Refresh
- Me.Requery
- Exit_Command564_Click:
- Exit Sub
- Err_Command564_Click:
- MsgBox Err.Description
- Resume Exit_Command564_Click
- End Sub
复制代码 |
|