Hi,
I have a form that should open blank but users should not enter anything in fields except the filter fields. When we move to next record it should be editable. I am using following code but still when form is opened users are able to enter. Could someone tell where I am doing wrong.
Thanks in advance
Form_open
'===================================================================================
' Default the filtering
'===================================================================================
cmdFilter.Caption = FILTER_ON_TEXT_G
ToggleFilter
'===================================================================================
' Go to the first record
'===================================================================================
If Not (Me.Recordset.BOF And Me.Recordset.EOF) Then Me.Recordset.MoveFirst
'===================================================================================
' Maximise Main form
'===================================================================================
DoCmd.Maximize
End Sub
Private Sub ToggleFilter()
On Error GoTo ToggleFilter_ERR
Dim strICPFilter As String
Dim strSQL As String
'===================================================================================
' Filter is already on - switch off
'===================================================================================
If cmdFilter.Caption = FILTER_ON_TEXT_G = True Then
Me.FilterOn = False
Me.Filter = ""
txtCurrentFilter = Me.Filter
cmdFilter.Caption = FILTER_OFF_TEXT_G
cmdFilter.SetFocus
txtFilterValue.Enabled = True
cmbFilterType.Enabled = True
txtFilterValue = ""
cmbFilterType = "ICP Number"
If Not (Me.Recordset.BOF And Me.Recordset.EOF) Then Me.Recordset.MoveFirst
'===================================================================================
' Filter is off - switch on
'===================================================================================
Else
'===================================================================================
' Get the value to Filter for
'===================================================================================
txtFilterValue.SetFocus
strICPFilter = Trim(txtFilterValue.Text)
'===================================================================================
' Ensure we have a Filter value
'===================================================================================
If Len(strICPFilter) = 0 Then
ReportErrorMessage "You must enter a value in the equals field in order to filter."
Exit Sub
End If
I have a form that should open blank but users should not enter anything in fields except the filter fields. When we move to next record it should be editable. I am using following code but still when form is opened users are able to enter. Could someone tell where I am doing wrong.
Thanks in advance
Form_open
'===================================================================================
' Default the filtering
'===================================================================================
cmdFilter.Caption = FILTER_ON_TEXT_G
ToggleFilter
'===================================================================================
' Go to the first record
'===================================================================================
If Not (Me.Recordset.BOF And Me.Recordset.EOF) Then Me.Recordset.MoveFirst
'===================================================================================
' Maximise Main form
'===================================================================================
DoCmd.Maximize
End Sub
Private Sub ToggleFilter()
On Error GoTo ToggleFilter_ERR
Dim strICPFilter As String
Dim strSQL As String
'===================================================================================
' Filter is already on - switch off
'===================================================================================
If cmdFilter.Caption = FILTER_ON_TEXT_G = True Then
Me.FilterOn = False
Me.Filter = ""
txtCurrentFilter = Me.Filter
cmdFilter.Caption = FILTER_OFF_TEXT_G
cmdFilter.SetFocus
txtFilterValue.Enabled = True
cmbFilterType.Enabled = True
txtFilterValue = ""
cmbFilterType = "ICP Number"
If Not (Me.Recordset.BOF And Me.Recordset.EOF) Then Me.Recordset.MoveFirst
'===================================================================================
' Filter is off - switch on
'===================================================================================
Else
'===================================================================================
' Get the value to Filter for
'===================================================================================
txtFilterValue.SetFocus
strICPFilter = Trim(txtFilterValue.Text)
'===================================================================================
' Ensure we have a Filter value
'===================================================================================
If Len(strICPFilter) = 0 Then
ReportErrorMessage "You must enter a value in the equals field in order to filter."
Exit Sub
End If