Hello there, is been a while since I last posted here, mostly because I didn't have the time I needed to program. But now, I reentered the exciting world in Visual Basic, 'cause I have a lot of time now and my mom wants me to make her a database :lol:
Anyway, I'm using VB 6.0 and I thought it was going to be easier than it's becomed. It all started when I tried to add a Search command button to the database the Data Form Object Wizard built. I searched through the internet and the forums and found out about SQL and ADO and read some tutorials on them, even the one that is posted at the beginning of the VB forum and decided to make one from scratch. But now, although my code seems right, it won't return me any records. I want the records to be input into Text Boxes. Here's the starting code I'm using in the Form_Load:
Private Sub Form_Load()
Dim Pacdb As New ADODB.Connection
Dim Pacrs As New ADODB.Recordset
Dim Paccmd As New ADODB.Command
Pacdb.CursorLocation = adUseClient
Pacdb.ConnectionString = "PROVIDER=Microsoft.Jet.OLEDB.3.51;Data Source=C:\Documents and Settings\Owner\My Documents\PruebaPropac\HistoriasClĂnicas.mdb;Mode=Read|Write"
Pacdb.Open
With Paccmd
.ActiveConnection = Pacdb
.CommandText = "SELECT * FROM Pacientes ORDER BY Nombre;"
.CommandType = adCmdText
End With
With Pacrs
.CursorType = adOpenStatic
.CursorLocation = adUseClient
.LockType = adLockOptimistic
.Open Paccmd
End With
Please help me, tell me what code I'm missing for the database to return each value in a predetermined text box.