• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

Calling VB gurus...

Mean MrMustard

Diamond Member
I know this goes in the Programming Forum, but I rarely get answers in there is I'm here. What the hell is wrong with this code, I can't figure it out. Any suggestions are greatly appreciated!

Option Explicit
Private rsConcerts As ADODB.Recordset
Private rsSeats As ADODB.Recordset
Private rsReservations As ADODB.Recordset
Private cnConcert As ADODB.Connection
Private pstrConDate As String
Private pstrConTitle As String

Private Sub Form_Load()
Set cnConcert = New ADODB.Connection
cnConcert.ConnectionString = "Provider = " _
& "Microsoft.Jet.OLEDB.4.0; " _
& "Data Source = A:\Assignment5\concert.mdb"

cnConcert.CursorLocation = adUseClient

cnConcert.Open
Set rsConcerts = New ADODB.Recordset
Set rsSeats = New ADODB.Recordset
Set rsReservations = New ADODB.Recordset

Call rsConcerts.Open("Concerts", cnConcert, adOpenStatic, adLockPessimistic, adCmdTable)

Call rsSeats.Open("Seats", cnConcert, adOpenStatic, adLockPessimistic, adCmdTable)

Call rsReservations.Open("Reservations", cnConcert, adOpenStatic, adLockPessimistic, adCmdTable)

Do Until rsConcerts.EOF
rsConcerts.movefirst
pstrConDate = rsConcerts!ConcertDate
pstrConTitle = rsConcerts!Title
cbo1.AddItem pstrConDate & "-" & pstrConTitle
rsConcerts.MoveNext
Loop
End Sub
 
Originally posted by: ELP
I know this goes in the Programming Forum, but I rarely get answers in there is I'm here. What the hell is wrong with this code, I can't figure it out. Any suggestions are greatly appreciated!

Option Explicit
Private rsConcerts As ADODB.Recordset
Private rsSeats As ADODB.Recordset
Private rsReservations As ADODB.Recordset
Private cnConcert As ADODB.Connection
Private pstrConDate As String
Private pstrConTitle As String

Private Sub Form_Load()
Set cnConcert = New ADODB.Connection
cnConcert.ConnectionString = "Provider = " _
& "Microsoft.Jet.OLEDB.4.0; " _
& "Data Source = A:\Assignment5\concert.mdb"

cnConcert.CursorLocation = adUseClient

cnConcert.Open
Set rsConcerts = New ADODB.Recordset
Set rsSeats = New ADODB.Recordset
Set rsReservations = New ADODB.Recordset

Call rsConcerts.Open("Concerts", cnConcert, adOpenStatic, adLockPessimistic, adCmdTable)

Call rsSeats.Open("Seats", cnConcert, adOpenStatic, adLockPessimistic, adCmdTable)

Call rsReservations.Open("Reservations", cnConcert, adOpenStatic, adLockPessimistic, adCmdTable)

Do Until rsConcerts.EOF
rsConcerts.movefirst
pstrConDate = rsConcerts!ConcertDate
pstrConTitle = rsConcerts!Title
cbo1.AddItem pstrConDate & "-" & pstrConTitle
rsConcerts.MoveNext
Loop
End Sub


what does it do/not do?
 
Do Until rsConcerts.EOF
rsConcerts.movefirst
pstrConDate = rsConcerts!ConcertDate
pstrConTitle = rsConcerts!Title
cbo1.AddItem pstrConDate & "-" & pstrConTitle
rsConcerts.MoveNext
Loop

The program should stop at the EOF, when I run the program it won't even appear unless I comment out the Do Until Loop. I think the "rsConcerts.EOF" isn't worded right. When its commented out the program loads but obviously the combobox isn't loaded.
 
Thanks ruf, I knew it would be something stupid like that.

I have another problem. I have a ListView set up and I need to be able to click on the column headings to sort in ascending order, if I click on the same header again, it should sort in descending order.
 
Back
Top