PSUAlumni87
Programmer
I am a programmer who has been using Access for a few years. I am a few steps above the casual user, but still very new to all the code. I have written the follwong code as a row souce type to fill a list box on a form I created.
I am getting a data mismatch error. Any clues? Any help at all would be appreciated. I work from homw and have no other programmers to bounce Ideas off of. when I hit a wall like this I am stalled until I can figure it out.
Thanks for any help anyone can give me.
Function namestodate(C As Control, ID, row, col, action)
Static NameofSite As Recordset
Dim SQLText2
Select Case action
Case acLBInitialize
SQLText2 = "SELECT DISTINCT [Site Code and Name Table].SiteName, [Tower Data Table].InspDate, [Tower Data Table].SiteID " & _
"FROM [Tower Data Table] LEFT JOIN [Site Code and Name Table] ON [Tower Data Table].SiteID = [Site Code and Name Table].SiteID " & _
"ORDER BY [Site Code and Name Table].SiteName, [Tower Data Table].InspDate;"
'THE FOLLOWING LINE IS WHERE I AM GETTING THE ERROR
Set NameofSite = CurrentDb.OpenRecordset(SQLText2)
namestodate = True
Case acLBOpen
namestodate = Timer
Case acLBGetRowCount
NameofSite.MoveLast
namestodate = NameofSite.RecordCount
NameofSite.MoveFirst
Case acLBGetColumnCount
namestodate = 1
Case acLBGetColumnWidth
namestodate = -1
Case acLBGetValue
'If row = 0 Then
' CompanyNames = "<All>"
'Else
NameofSite.MoveFirst
NameofSite.Move row
namestodate = NameofSite![SiteName]
'End If
Case acLBGetFormat
Case acLBEnd
Case acLBClose
End Select
End Function
I am getting a data mismatch error. Any clues? Any help at all would be appreciated. I work from homw and have no other programmers to bounce Ideas off of. when I hit a wall like this I am stalled until I can figure it out.
Thanks for any help anyone can give me.
Function namestodate(C As Control, ID, row, col, action)
Static NameofSite As Recordset
Dim SQLText2
Select Case action
Case acLBInitialize
SQLText2 = "SELECT DISTINCT [Site Code and Name Table].SiteName, [Tower Data Table].InspDate, [Tower Data Table].SiteID " & _
"FROM [Tower Data Table] LEFT JOIN [Site Code and Name Table] ON [Tower Data Table].SiteID = [Site Code and Name Table].SiteID " & _
"ORDER BY [Site Code and Name Table].SiteName, [Tower Data Table].InspDate;"
'THE FOLLOWING LINE IS WHERE I AM GETTING THE ERROR
Set NameofSite = CurrentDb.OpenRecordset(SQLText2)
namestodate = True
Case acLBOpen
namestodate = Timer
Case acLBGetRowCount
NameofSite.MoveLast
namestodate = NameofSite.RecordCount
NameofSite.MoveFirst
Case acLBGetColumnCount
namestodate = 1
Case acLBGetColumnWidth
namestodate = -1
Case acLBGetValue
'If row = 0 Then
' CompanyNames = "<All>"
'Else
NameofSite.MoveFirst
NameofSite.Move row
namestodate = NameofSite![SiteName]
'End If
Case acLBGetFormat
Case acLBEnd
Case acLBClose
End Select
End Function