stukanewss
MIS
I have created an event procedure in a form on access 2000 and it works. I have sent the DB to another Access 2000 user and the code does not execute -- nothing happens. I have checked the references on her machine and they match mine. Here is a sample of the code. Please help!
Private Sub Command14_Click()
Dim icounter As Integer
Dim squery As String
Dim sselected As String
For icounter = 0 To List0.ListCount - 1
If List0.Selected(icounter) Then
sselected = sselected & IIf(Len(sselected) = 0, "", "," & Chr(39) & List0.Column(0, icounter) & Chr(39)
End If
Next icounter
'MsgBox (sselected)
If Len(sselected) > 0 Then
squery = "SELECT BEOpty.Account, BEOpty.Author, BEOpty.Title, BEOpty.Ed, BEOpty.Units, BEOpty.Revenue, BEOpty.Status, BEOpty.[Decision Date], BEOpty.Discipline, BEOpty.Course, BEOpty.Type, BEOpty.[Sales Rep], BEOpty.[Semester of Use], BEOpty.ISBN FROM BEOpty WHERE (((BEOpty.[Sales Rep]) In ( " & sselected & "));"
Else
squery = "SELECT BEOpty.Account, BEOpty.Author, BEOpty.Title, BEOpty.Ed, BEOpty.Units, BEOpty.Revenue, BEOpty.Status, BEOpty.[Decision Date], BEOpty.Discipline, BEOpty.Course, BEOpty.Type, BEOpty.[Sales Rep], BEOpty.[Semester of Use], BEOpty.ISBN FROM BEOpty;"
End If
'MsgBox (squery)
On Error Resume Next
DoCmd.DeleteObject acQuery, "BEopty Query Rep"
Dim db As DAO.Database, qdf As QueryDef
Set db = CurrentDb
Set qdf = db.CreateQueryDef("BEopty Query Rep", squery)
db.QueryDefs.Append qdf
DoCmd.OpenQuery "BEopty Query Rep"
DoCmd.OpenReport "Rep Pending Summary", acViewPreview
DoCmd.Close acQuery, "BEopty Query Rep"
End Sub
Private Sub Command14_Click()
Dim icounter As Integer
Dim squery As String
Dim sselected As String
For icounter = 0 To List0.ListCount - 1
If List0.Selected(icounter) Then
sselected = sselected & IIf(Len(sselected) = 0, "", "," & Chr(39) & List0.Column(0, icounter) & Chr(39)
End If
Next icounter
'MsgBox (sselected)
If Len(sselected) > 0 Then
squery = "SELECT BEOpty.Account, BEOpty.Author, BEOpty.Title, BEOpty.Ed, BEOpty.Units, BEOpty.Revenue, BEOpty.Status, BEOpty.[Decision Date], BEOpty.Discipline, BEOpty.Course, BEOpty.Type, BEOpty.[Sales Rep], BEOpty.[Semester of Use], BEOpty.ISBN FROM BEOpty WHERE (((BEOpty.[Sales Rep]) In ( " & sselected & "));"
Else
squery = "SELECT BEOpty.Account, BEOpty.Author, BEOpty.Title, BEOpty.Ed, BEOpty.Units, BEOpty.Revenue, BEOpty.Status, BEOpty.[Decision Date], BEOpty.Discipline, BEOpty.Course, BEOpty.Type, BEOpty.[Sales Rep], BEOpty.[Semester of Use], BEOpty.ISBN FROM BEOpty;"
End If
'MsgBox (squery)
On Error Resume Next
DoCmd.DeleteObject acQuery, "BEopty Query Rep"
Dim db As DAO.Database, qdf As QueryDef
Set db = CurrentDb
Set qdf = db.CreateQueryDef("BEopty Query Rep", squery)
db.QueryDefs.Append qdf
DoCmd.OpenQuery "BEopty Query Rep"
DoCmd.OpenReport "Rep Pending Summary", acViewPreview
DoCmd.Close acQuery, "BEopty Query Rep"
End Sub