Last resort, VB/Access ADO problem
#1
Scooby Regular
Thread Starter
Join Date: Feb 2002
Location: Lurkin Somewhere
Posts: 7,951
Likes: 0
Received 0 Likes
on
0 Posts
Its being 6months since ive used ADO stuff. I found an old Uni program which use's this printstatement to a form.
Private Sub printFields()
If rsMatch.EOF Then 'If at the end of recordset , terminate program
Unload Form1
rsMatch.Close ' Close the recordsets
dbConnection.Close ' and the connection
Exit Sub
End If
intMatchID = rsMatch("matchID") ' Get the ID for the this match
findSquad ' Find the squad who played in this match
' Print the information to the immediate window
Debug.Print " "
Debug.Print "Match ID: "; rsMatch("matchID")
Debug.Print rsMatch("matchDate")
Debug.Print "Against: "; rsMatch("teamName")
Debug.Print "At: "; rsMatch("venu")
Debug.Print "Referee: "; rsMatch("refereeForename") + " " + rsMatch("refereeSurname")
Debug.Print "Score: " + CStr(rsMatch("us")) + " " + CStr(rsMatch("them"))
Debug.Print "Squad:"
'Loop through the Squads recordset, printing filtered players
Do Until rsSquads.EOF
Debug.Print " "; rsSquads("playerForename"); " "; rsSquads("playerSurname"); " "; rsSquads("goals")
rsSquads.MoveNext
Loop
rsSquads.Close 'Close the Squads recordset again
End Sub
Its printing the info to debug. ive tried txtans.text tried labels.
Im tearing my hair out, whats the correct code to print in either a lable or text box.
Cant do any work till i get this simple thing working!
Cheers
Si
Private Sub printFields()
If rsMatch.EOF Then 'If at the end of recordset , terminate program
Unload Form1
rsMatch.Close ' Close the recordsets
dbConnection.Close ' and the connection
Exit Sub
End If
intMatchID = rsMatch("matchID") ' Get the ID for the this match
findSquad ' Find the squad who played in this match
' Print the information to the immediate window
Debug.Print " "
Debug.Print "Match ID: "; rsMatch("matchID")
Debug.Print rsMatch("matchDate")
Debug.Print "Against: "; rsMatch("teamName")
Debug.Print "At: "; rsMatch("venu")
Debug.Print "Referee: "; rsMatch("refereeForename") + " " + rsMatch("refereeSurname")
Debug.Print "Score: " + CStr(rsMatch("us")) + " " + CStr(rsMatch("them"))
Debug.Print "Squad:"
'Loop through the Squads recordset, printing filtered players
Do Until rsSquads.EOF
Debug.Print " "; rsSquads("playerForename"); " "; rsSquads("playerSurname"); " "; rsSquads("goals")
rsSquads.MoveNext
Loop
rsSquads.Close 'Close the Squads recordset again
End Sub
Its printing the info to debug. ive tried txtans.text tried labels.
Im tearing my hair out, whats the correct code to print in either a lable or text box.
Cant do any work till i get this simple thing working!
Cheers
Si
#2
Scooby Regular
Join Date: Sep 2002
Location: French side of the border at Geneva, Switzerland
Posts: 5,703
Likes: 0
Received 0 Likes
on
0 Posts
IMHO Debug is of limited use (only for a line or two). Try dumping the data to a text *file* using
Open filename for Output as #n
and then printing the lines to it before
Close #n
closing it. Doing it that way, you'll have a permanent record (excuse the pun) of what's being read in the recordset.
Open filename for Output as #n
and then printing the lines to it before
Close #n
closing it. Doing it that way, you'll have a permanent record (excuse the pun) of what's being read in the recordset.
#3
Scooby Regular
Thread Starter
Join Date: Feb 2002
Location: Lurkin Somewhere
Posts: 7,951
Likes: 0
Received 0 Likes
on
0 Posts
debugs the example code mate.
I want to get rid the example and put the data in either lables or text boxes.
Just want to get that working, then make a start on my assignment! but ill be bugger if i can remember what i need to put something like
txtans.txt = rsmatch("venu")
or something.....
I want to get rid the example and put the data in either lables or text boxes.
Just want to get that working, then make a start on my assignment! but ill be bugger if i can remember what i need to put something like
txtans.txt = rsmatch("venu")
or something.....
#4
Scooby Regular
Join Date: Sep 2002
Location: French side of the border at Geneva, Switzerland
Posts: 5,703
Likes: 0
Received 0 Likes
on
0 Posts
Isn't the default property for a textbox .text ?
Try just using txtans = rsmatch("venu")
For labels, it should be labelname.caption = rsmatch("venu")
Try just using txtans = rsmatch("venu")
For labels, it should be labelname.caption = rsmatch("venu")
Thread
Thread Starter
Forum
Replies
Last Post