Hi,
I would like to use my code form more then one form to find a record on the form. I have tried to change the code but get error or no result. What is wrong?
The problem is in the
SET RS.....
...BOOKMARK
Code
Private Sub btnZoeken_Click()
On Error GoTo Err_btnZoeken_Click
' De record zoeken die overeenkomt met het besturingselement
Dim rs As Object
Dim ZoekNummer As String
Dim Bontype As String
Dim Formuliernaam As Form
If IsLoaded("frmOpvolging") Then
Set Formuliernaam = Forms!frmOpvolging
End If
If IsLoaded("frmOverzichtdocumenten") Then
Set Formuliernaam = Forms!frmOverzichtdocumenten
End If
ZoekNummer = txtBonnr
Bontype = cboTypeBon
'HERE IS THE PROBLEM I THINK!!!
Set rs = Forms!frmOpvolging.RecordsetClone
'Set rs = Formuliernaam.RecordsetClone
Select Case Bontype
Case "factuur":
rs.FindFirst "[faktuurnr] = " & ZoekNummer
If rs.NoMatch Then
MsgBox "Bonnummer niet gevonden"
Else
DoCmd.Close
Forms!frmOpvolging.Bookmark = rs.Bookmark
'Formuliernaam.bookmark=rs.bookmark
End If
End Select
Exit_btnZoeken_Click:
Exit Sub
Err_btnZoeken_Click:
MsgBox Err.Description
Resume Exit_btnZoeken_Click
End Sub
I would like to use my code form more then one form to find a record on the form. I have tried to change the code but get error or no result. What is wrong?
The problem is in the
SET RS.....
...BOOKMARK
Code
Private Sub btnZoeken_Click()
On Error GoTo Err_btnZoeken_Click
' De record zoeken die overeenkomt met het besturingselement
Dim rs As Object
Dim ZoekNummer As String
Dim Bontype As String
Dim Formuliernaam As Form
If IsLoaded("frmOpvolging") Then
Set Formuliernaam = Forms!frmOpvolging
End If
If IsLoaded("frmOverzichtdocumenten") Then
Set Formuliernaam = Forms!frmOverzichtdocumenten
End If
ZoekNummer = txtBonnr
Bontype = cboTypeBon
'HERE IS THE PROBLEM I THINK!!!
Set rs = Forms!frmOpvolging.RecordsetClone
'Set rs = Formuliernaam.RecordsetClone
Select Case Bontype
Case "factuur":
rs.FindFirst "[faktuurnr] = " & ZoekNummer
If rs.NoMatch Then
MsgBox "Bonnummer niet gevonden"
Else
DoCmd.Close
Forms!frmOpvolging.Bookmark = rs.Bookmark
'Formuliernaam.bookmark=rs.bookmark
End If
End Select
Exit_btnZoeken_Click:
Exit Sub
Err_btnZoeken_Click:
MsgBox Err.Description
Resume Exit_btnZoeken_Click
End Sub