M
Martin
Who can help me with the following problem in Access 2000:
I've got a button in a form to open a report. In this report I only want
some sorted information. To sort I select first in a combobox
(cboProjectverslag), next to the button.
The code under the button is pasted below.
With this code I'm not able to make the report work. I've tried everything,
but nothing works. So I guess the code is wrong!
Who can help?
Thanks,
Martin
'===start code:
Private Sub AfdrVBRapp_Click()
On Error GoTo Err_AfdrVBRapp_Click
Dim stDocName As String
Dim strSQL As String
If Len(Me!cboProjectVerslag) Then
strSQL = "SELECT * FROM [qryOverzicht] " & _
"WHERE [UitvrId]=" & Me!cboProjectVerslag
Else
strSQL = "SELECT * FROM [qryOverzicht]"
End If
stDocName = "rpBesprVerslag"
DoCmd.OpenReport stDocName, acPreview
.RecordSource = strSQL
.Form.Requery
End With
'=== eind code
I've got a button in a form to open a report. In this report I only want
some sorted information. To sort I select first in a combobox
(cboProjectverslag), next to the button.
The code under the button is pasted below.
With this code I'm not able to make the report work. I've tried everything,
but nothing works. So I guess the code is wrong!
Who can help?
Thanks,
Martin
'===start code:
Private Sub AfdrVBRapp_Click()
On Error GoTo Err_AfdrVBRapp_Click
Dim stDocName As String
Dim strSQL As String
If Len(Me!cboProjectVerslag) Then
strSQL = "SELECT * FROM [qryOverzicht] " & _
"WHERE [UitvrId]=" & Me!cboProjectVerslag
Else
strSQL = "SELECT * FROM [qryOverzicht]"
End If
stDocName = "rpBesprVerslag"
DoCmd.OpenReport stDocName, acPreview
.RecordSource = strSQL
.Form.Requery
End With
'=== eind code