B
Ben
Hi all,
What I am trying to do here is get from a table in datasheet view to a
filtered record in another form (read only) via a button. That works great.
Now from this form, with button again I try to go to and edit a form on which
I have locked the fields.
Unfortunately, when I press my button [unlock] on this form, it only changes
the colour (as it should) but I cannot edit the record. On top of that it
moves back to the first record...
Annyone who knows what I can do here... am novice in VBA but am learning
much thanks to this discussion forum.
Here is my coding so far.
Button from read only form to the filtered one to edit.
Private Sub Kommandoknapp94_Click()
On Error GoTo Err_Kommandoknapp94_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "Läkare List"
stLinkCriteria = "[ID]=" & Me![ID]
DoCmd.OpenForm stDocName, , , stLinkCriteria
Exit_Kommandoknapp94_Click:
Exit Sub
Err_Kommandoknapp94_Click:
MsgBox Err.Description
Resume Exit_Kommandoknapp94_Click
End Sub
And here is the button that does the locking/Unlocking...
Private Sub Unlock_Läkare_Click()
If Me.Unlock_Läkare.Caption = "Edit Practician" Then
Me.Firstname.Locked = False
Me.Lastname.Locked = False
Me!Firstname.ForeColor = vbRed
Me!Lastname.ForeColor = vbRed
Me.Filter = ""
Me.FilterOn = True
Me.Unlock_Läkare.Caption = "Lock Changes"
Else
Me.Firstname.Locked = True
Me.Lastname.Locked = True
Me!Firstname.ForeColor = vbBlack
Me!Lastname.ForeColor = vbBlack
Me.Unlock_Läkare.Caption = "Edit Practician"
End If
End Sub
It all works great when I open the forms separately.
So the goal is : Able to edit the record that I open from the other form. on
click button.
Alternative I have in mind is create a new form without the buttons... but
then my locking security is gone...
Thanks in advance,
Greetings from Sweden
Ben
What I am trying to do here is get from a table in datasheet view to a
filtered record in another form (read only) via a button. That works great.
Now from this form, with button again I try to go to and edit a form on which
I have locked the fields.
Unfortunately, when I press my button [unlock] on this form, it only changes
the colour (as it should) but I cannot edit the record. On top of that it
moves back to the first record...
Annyone who knows what I can do here... am novice in VBA but am learning
much thanks to this discussion forum.
Here is my coding so far.
Button from read only form to the filtered one to edit.
Private Sub Kommandoknapp94_Click()
On Error GoTo Err_Kommandoknapp94_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "Läkare List"
stLinkCriteria = "[ID]=" & Me![ID]
DoCmd.OpenForm stDocName, , , stLinkCriteria
Exit_Kommandoknapp94_Click:
Exit Sub
Err_Kommandoknapp94_Click:
MsgBox Err.Description
Resume Exit_Kommandoknapp94_Click
End Sub
And here is the button that does the locking/Unlocking...
Private Sub Unlock_Läkare_Click()
If Me.Unlock_Läkare.Caption = "Edit Practician" Then
Me.Firstname.Locked = False
Me.Lastname.Locked = False
Me!Firstname.ForeColor = vbRed
Me!Lastname.ForeColor = vbRed
Me.Filter = ""
Me.FilterOn = True
Me.Unlock_Läkare.Caption = "Lock Changes"
Else
Me.Firstname.Locked = True
Me.Lastname.Locked = True
Me!Firstname.ForeColor = vbBlack
Me!Lastname.ForeColor = vbBlack
Me.Unlock_Läkare.Caption = "Edit Practician"
End If
End Sub
It all works great when I open the forms separately.
So the goal is : Able to edit the record that I open from the other form. on
click button.
Alternative I have in mind is create a new form without the buttons... but
then my locking security is gone...
Thanks in advance,
Greetings from Sweden
Ben