Hello
I have my main for that has tab control with about seven tabs on it. All but one of these tabs have the enable property set to false. So people can viewclient information. but not change.
Of one of the tabs has another tab control with 3 pages on it. this tab has the enable property set to true but the tabs on the sub form are set to 'enabled = false'. So they cant be changed
At the top of the main form is a command button (edit) that has an on click event procedure and it then changes all of the tab properties to true so information can be changed. even the ones on the sub forms are changed. It also changed the visble property of the edit button so it is hidden and enables a save button to appear.
When staff are finished editing the information they click the save button and if then changes the tabs back to 'enable = false' so that information cant be changed again and also loads another form for users to complete.
This is where my problem comes is. The enable property is changed for the tabs on my main form but on the subform the tabs there dont get changed as it comes up with the following error "Run Time error 2164 You cant disable a control while it has the focus."
I have tried to change the focus to a command button on the main form but i still get this error.
can someone advise what i am missing. I have posted the code i have on save event procedure for you to have a look at. I am an intermediate at VB Code am quick to learn
Thanks in Advance
Andrew C
Private Sub sAVE_Click()
If Me.Dirty Then Me.Dirty = False
If Me.Deceased = True Then
'Client ceased using your services
Me.Active = "No"
Me.DDate.Enabled = False
Me.DDate.Locked = True
Me.Cessation_Reason.Enabled = False
Me.Cessation_Reason.Locked = True
Else
'Client still uses your services
Me.DDate.Enabled = False
Me.Cessation_Reason.Enabled = False
Me.DDate.Locked = False
Me.Cessation_Reason.Locked = False
End If
Me.New_Client.Visible = True
Me.New_Client.SetFocus
Me.General.Enabled = False
Me.Core.Enabled = False
Me.Child246.Form![Page 1].Enabled = False
Me.Child246.Form![Page 2].Enabled = False
Me.Functional.Enabled = False
Me.Living_Arrangements.Enabled = False
Me.Carer.Enabled = False
Me.Child207.Form![Page 1].Enabled = False
Me.Child207.Form![Page 2].Enabled = False
Me.Child207.Form![Page 3].Enabled = False
Me.Psychosocial.Enabled = False
Me.Health_Behaviours.Enabled = False
Me.Label97.Visible = False
Me.Edit.Visible = True
Me.Menu.Visible = True
Me.save.Visible = False
Me.Search.Enabled = True
stDocName = "Updates"
stLinkCriteria = "[Clientsid]=" & Me![ID]
DoCmd.OpenForm stDocName, , , stLinkCriteria
DoCmd.Close acForm, "Client_Active"
Exit_sAVE_Click:
Exit Sub
End Sub
I have my main for that has tab control with about seven tabs on it. All but one of these tabs have the enable property set to false. So people can viewclient information. but not change.
Of one of the tabs has another tab control with 3 pages on it. this tab has the enable property set to true but the tabs on the sub form are set to 'enabled = false'. So they cant be changed
At the top of the main form is a command button (edit) that has an on click event procedure and it then changes all of the tab properties to true so information can be changed. even the ones on the sub forms are changed. It also changed the visble property of the edit button so it is hidden and enables a save button to appear.
When staff are finished editing the information they click the save button and if then changes the tabs back to 'enable = false' so that information cant be changed again and also loads another form for users to complete.
This is where my problem comes is. The enable property is changed for the tabs on my main form but on the subform the tabs there dont get changed as it comes up with the following error "Run Time error 2164 You cant disable a control while it has the focus."
I have tried to change the focus to a command button on the main form but i still get this error.
can someone advise what i am missing. I have posted the code i have on save event procedure for you to have a look at. I am an intermediate at VB Code am quick to learn
Thanks in Advance
Andrew C
Private Sub sAVE_Click()
If Me.Dirty Then Me.Dirty = False
If Me.Deceased = True Then
'Client ceased using your services
Me.Active = "No"
Me.DDate.Enabled = False
Me.DDate.Locked = True
Me.Cessation_Reason.Enabled = False
Me.Cessation_Reason.Locked = True
Else
'Client still uses your services
Me.DDate.Enabled = False
Me.Cessation_Reason.Enabled = False
Me.DDate.Locked = False
Me.Cessation_Reason.Locked = False
End If
Me.New_Client.Visible = True
Me.New_Client.SetFocus
Me.General.Enabled = False
Me.Core.Enabled = False
Me.Child246.Form![Page 1].Enabled = False
Me.Child246.Form![Page 2].Enabled = False
Me.Functional.Enabled = False
Me.Living_Arrangements.Enabled = False
Me.Carer.Enabled = False
Me.Child207.Form![Page 1].Enabled = False
Me.Child207.Form![Page 2].Enabled = False
Me.Child207.Form![Page 3].Enabled = False
Me.Psychosocial.Enabled = False
Me.Health_Behaviours.Enabled = False
Me.Label97.Visible = False
Me.Edit.Visible = True
Me.Menu.Visible = True
Me.save.Visible = False
Me.Search.Enabled = True
stDocName = "Updates"
stLinkCriteria = "[Clientsid]=" & Me![ID]
DoCmd.OpenForm stDocName, , , stLinkCriteria
DoCmd.Close acForm, "Client_Active"
Exit_sAVE_Click:
Exit Sub
End Sub