R
Rick Humphrey
HI-
I'm working in Access 2000 with a List box that is inteneded to look up a
record on the form. I have MultiSelect property set to 'None' . For some
reason the ListBox is behaiving as if MultiSelect were true... IT never
release the previous selection which remains highlighted. This strange
behaivor then somehow cause some strange things in memory to occur.. here is
th forms code which I thought pretty simple....Option Compare Database, I
suspect there must be some method I am missing that would clear the previous
selection.... I would think it appropriate for that method to be executed in
the form.current procedure, can anyone help me to eliminate this odd
behaviour?
Thanks,
Rick
Private Sub Form_Load()
DoCmd.Maximize
End Sub
Private Sub Form_Current()
If Form.NewRecord = True Then
'new record
Unit = CInt(Forms!menuform.UnitLabel.Caption)
Else
'existing record
ReportsListBox.Value = ReportID
'some method here
End If
End Sub
Private Sub Form_BeforeUpdate(Cancel As Integer)
'MsgBox "validate"
Dim sErr As String
sErr = ""
Cancel = False
If IsNull(ReportName) Then sErr = sErr & "* Report Name is Req'd" & vbCrLf
If IsNull(Unit) Then sErr = sErr & "* Unit is Req'd" & vbCrLf
If IsNull(DateOfFailure) Then sErr = sErr & "* Date of Failure is Req'd"
& vbCrLf
If IsNull(PreparedBy) Then sErr = sErr & "* Prepared By is Req'd" & vbCrLf
If IsNull(DatePreparedBy) Then sErr = sErr & "* Date Prepared By is
Req'd" & vbCrLf
If VBA.Len(sErr) > 0 Then
ValSumLabel.Caption = sErr
Cancel = True
Else
ValSumLabel.Caption = ""
Cancel = False
End If
End Sub
Private Sub Form_AfterUpdate()
' MsgBox "requery Listbox"
ReportsListBox.Requery
End Sub
Private Sub ReportsListBox_AfterUpdate()
' Find the record that matches the control.
Dim rs As Object
Set rs = Me.Recordset.Clone
rs.FindFirst "[ReportID] = " & Str(Me![ReportsListBox])
Me.Bookmark = rs.Bookmark
End Sub
I'm working in Access 2000 with a List box that is inteneded to look up a
record on the form. I have MultiSelect property set to 'None' . For some
reason the ListBox is behaiving as if MultiSelect were true... IT never
release the previous selection which remains highlighted. This strange
behaivor then somehow cause some strange things in memory to occur.. here is
th forms code which I thought pretty simple....Option Compare Database, I
suspect there must be some method I am missing that would clear the previous
selection.... I would think it appropriate for that method to be executed in
the form.current procedure, can anyone help me to eliminate this odd
behaviour?
Thanks,
Rick
Private Sub Form_Load()
DoCmd.Maximize
End Sub
Private Sub Form_Current()
If Form.NewRecord = True Then
'new record
Unit = CInt(Forms!menuform.UnitLabel.Caption)
Else
'existing record
ReportsListBox.Value = ReportID
'some method here
End If
End Sub
Private Sub Form_BeforeUpdate(Cancel As Integer)
'MsgBox "validate"
Dim sErr As String
sErr = ""
Cancel = False
If IsNull(ReportName) Then sErr = sErr & "* Report Name is Req'd" & vbCrLf
If IsNull(Unit) Then sErr = sErr & "* Unit is Req'd" & vbCrLf
If IsNull(DateOfFailure) Then sErr = sErr & "* Date of Failure is Req'd"
& vbCrLf
If IsNull(PreparedBy) Then sErr = sErr & "* Prepared By is Req'd" & vbCrLf
If IsNull(DatePreparedBy) Then sErr = sErr & "* Date Prepared By is
Req'd" & vbCrLf
If VBA.Len(sErr) > 0 Then
ValSumLabel.Caption = sErr
Cancel = True
Else
ValSumLabel.Caption = ""
Cancel = False
End If
End Sub
Private Sub Form_AfterUpdate()
' MsgBox "requery Listbox"
ReportsListBox.Requery
End Sub
Private Sub ReportsListBox_AfterUpdate()
' Find the record that matches the control.
Dim rs As Object
Set rs = Me.Recordset.Clone
rs.FindFirst "[ReportID] = " & Str(Me![ReportsListBox])
Me.Bookmark = rs.Bookmark
End Sub