Hi there, I am having a little trouble with this.
I am trying to get this code to work in order to show some controls:
Private Sub OpenCToEdit_Click() 'Opens the form in edit mode
On Error GoTo Err_OpenCToEdit_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "SetFocusFilter" 'Sets unbound filterbox for client type
DoCmd.RunMacro stDocName
stDocName = "SetFilterCompany"
DoCmd.RunMacro stDocName
stDocName = "frmCompanyClients"
stLinkCriteria = "[ClientType]=" & "'" & Me![FilterBy] & "'"
DoCmd.OpenForm stDocName, , , stLinkCriteria, acFormEdit
DoCmd.Close acForm, Me.name 'Closes the form I am navigating from
'Do I put the code in here to show the controls? It does not seem to work
'I get an error "Object not available"
'Me.NewRec.Visible = True these two controls are hidden normally
'Me.DelRec.Visible = True
Exit_OpenCToEdit_Click:
Exit Sub
Err_OpenCToEdit_Click:
MsgBox Err.Description
Resume Exit_OpenCToEdit_Click
End Sub
A solution to this will help in a lot of ways, as I can presumably specify other properties in the same way.
Thanks
Nic
I am trying to get this code to work in order to show some controls:
Private Sub OpenCToEdit_Click() 'Opens the form in edit mode
On Error GoTo Err_OpenCToEdit_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "SetFocusFilter" 'Sets unbound filterbox for client type
DoCmd.RunMacro stDocName
stDocName = "SetFilterCompany"
DoCmd.RunMacro stDocName
stDocName = "frmCompanyClients"
stLinkCriteria = "[ClientType]=" & "'" & Me![FilterBy] & "'"
DoCmd.OpenForm stDocName, , , stLinkCriteria, acFormEdit
DoCmd.Close acForm, Me.name 'Closes the form I am navigating from
'Do I put the code in here to show the controls? It does not seem to work
'I get an error "Object not available"
'Me.NewRec.Visible = True these two controls are hidden normally
'Me.DelRec.Visible = True
Exit_OpenCToEdit_Click:
Exit Sub
Err_OpenCToEdit_Click:
MsgBox Err.Description
Resume Exit_OpenCToEdit_Click
End Sub
A solution to this will help in a lot of ways, as I can presumably specify other properties in the same way.
Thanks
Nic