marcellvries
Programmer
Dear all,
I've created a complaint form database where people can enter complaints. If the complaint is resolved, it can be closed by a specific person.
When you click the 'close complaint' button, the system is supposed to check whether two specific fields are filled in. If not, a message is shown. If yes, the current complaint should be closed.
Situation:
I have 2 open complaints (records) and I want to close complaint 2.
Problem:
When I click the 'close' button, the system checks whether the two fields are filled in in Record 1 instead of the active record (2).
In case everything is filled in in record 1, it closes record 1 instead of record 2.
Question:
What is wrong with using Me.Controlvalue ? What should I change to make sure the field check If IsNull(Me.Tekst82) and the closing action rsAfwijkingAfsluiten!Afgesloten = True are performed on the active record instead of record 1?
Thank you very much in advance for your help.
With kind regards,
Marcel
I've created a complaint form database where people can enter complaints. If the complaint is resolved, it can be closed by a specific person.
When you click the 'close complaint' button, the system is supposed to check whether two specific fields are filled in. If not, a message is shown. If yes, the current complaint should be closed.
Situation:
I have 2 open complaints (records) and I want to close complaint 2.
Problem:
When I click the 'close' button, the system checks whether the two fields are filled in in Record 1 instead of the active record (2).
In case everything is filled in in record 1, it closes record 1 instead of record 2.
Code:
Private Sub cmdAfwijkingAfsluiten_Click()
Dim rsAfwijkingAfsluiten As New ADODB.Recordset
Dim SQLStmt As String
Me.Requery
On Error GoTo HandleError
If IsNull(Me.Tekst82) Then
MsgBox "Je moet een paraaf apotheker invullen"
Exit Sub
End If
If IsNull(Me.Tekst84) Then
MsgBox "Je moet een datum invullen"
Exit Sub
End If
If Not IsNull(Me.Volgnummer) And Not IsNull(Me.Tekst82) And Not IsNull(Me.Tekst84) Then
SQLStmt = "SELECT * FROM tblAfwijkingen WHERE AfwijkingID = " & Me.AfwijkingID
rsAfwijkingAfsluiten.Open SQLStmt, CurrentProject.Connection, adOpenDynamic, adLockOptimistic
If Not rsAfwijkingAfsluiten.EOF Then
rsAfwijkingAfsluiten!Afgesloten = True
rsAfwijkingAfsluiten.Update
End If
rsAfwijkingAfsluiten.Close
Set rsAfwijkingAfsluiten = Nothing
Me.Requery
DoCmd.Close
End If
Question:
What is wrong with using Me.Controlvalue ? What should I change to make sure the field check If IsNull(Me.Tekst82) and the closing action rsAfwijkingAfsluiten!Afgesloten = True are performed on the active record instead of record 1?
Thank you very much in advance for your help.
With kind regards,
Marcel