List Box problem

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi,

I have created a form that holds a list box. The user should be able to
select a 'comment' shown in the list box, double click it and the 'comment'
is then displayed in a Msgbox.

This works fine on my PC, which has full Access 2003 installed. The users
do not have Access 2003 and the database opens in run-time. They cannot
select any rows displayed within the list and subsequently get a 'invalid use
of null' error as there is nothing to display in the Msgbox.

The help files say the field in the control source could be spelt
incorrectly, but I want the list box to remain unbound.

Can anyone help?

Cheers,
Steve.
 
FB,
I'm not an expert, and it may well be a specific code or reference
problem... but I have found it is also helpful to check all of your code on
that form. For example, deleting a control but not removing the on click code
in VBA for that control.
 
I have sense checked the code, but cant see anything out of the ordinary.
Here it is:

Option Compare Database
Option Explicit


Dim intCur_MPR As Integer ' Stores the current MPR number being viewed.

Private Sub btnSearch_Click()
On Error GoTo Search_Err

Me.Requery
lstMPR_Audit.Requery

Set rstSQL = db.OpenRecordset("SELECT Count(MPR) AS CountOfMPR " & _
"FROM tblMPR_Tracker " & _
"WHERE MPR = " & txtSelect_MPR & ";")

intCur_MPR = 1
txtMPR_Count = intCur_MPR & " of " & rstSQL("CountofMPR")

Exit Sub

Search_Err:

If Error_Log(Err.Number, Error$, "frmUser_Comments Open Event") =
"Fixed" Then
Resume
Else
Resume Next
End If


End Sub


Private Sub btnNext_Click()
On Error GoTo Err_btnNext_Click


DoCmd.GoToRecord , , acNext

intCur_MPR = intCur_MPR + 1
txtMPR_Count = intCur_MPR & " of " & rstSQL("CountofMPR")

lstMPR_Audit.Requery


Exit_btnNext_Click:
Exit Sub

Err_btnNext_Click:
MsgBox Err.Description
Resume Exit_btnNext_Click

End Sub
Private Sub btnPrevious_Click()
On Error GoTo Err_btnPrevious_Click


DoCmd.GoToRecord , , acPrevious

intCur_MPR = intCur_MPR - 1
txtMPR_Count = intCur_MPR & " of " & rstSQL("CountofMPR")

lstMPR_Audit.Requery


Exit_btnPrevious_Click:
Exit Sub

Err_btnPrevious_Click:
MsgBox Err.Description
Resume Exit_btnPrevious_Click

End Sub

Private Sub Form_Open(Cancel As Integer)

If blnView_Records = True Then

Set rstSQL = db.OpenRecordset("SELECT MPR FROM tblMPR_Tracker " & _
"WHERE Workflow_Ref=" &
strSelected_item & ";")

txtSelect_MPR = rstSQL("MPR")

btnSearch_Click

End If

End Sub

Private Sub lstMPR_Audit_DblClick(Cancel As Integer)
On Error GoTo Audit_Err

MsgBox lstMPR_Audit.Column(2, lstMPR_Audit.ListIndex), vbInformation,
"MPR History - Audit Trail"
Exit Sub

Audit_Err:

If Error_Log(Err.Number, Error$, "zSYS_frmView_Records,
lstMPR_Audit_DBLClick") = "Fixed" Then
Resume
Else
Resume Next
End If

End Sub
 
The only other thing it could be, is the form opens as read only. Could this
be affecting it?

Cheers,
Steve.
 
Back
Top