2015-07-01 104 views

回答

0

通過在運行報表時將複選框的值傳遞到OpenArgs中,可以設置列的格式。以下是報告開碼可能是什麼樣子:

Private Sub cmdRun_Click() 

    Dim bFormatted As Boolean 
    bFormatted = chkFormat.Value 
    DoCmd.OpenReport "ReportName", acViewPreview, , , , bFormatted 

End Sub 

然後在報告的Open事件:

Private Sub Report_Open(Cancel As Integer) 

    Dim sArgs As String 
    Dim bFormatted As Boolean 

    sArgs = OpenArgs & "" 
    If sArgs <> "" Then 
     bFormatted = CBool(sArgs) 
    End If 

    If bFormatted Then 
     txtBox.Format = "0000" 
    End If 

End Sub 

我沒有檢查正確的格式。這是留給你的。

+0

你有沒有試過這個? –