Converting program to ADO
- From: "grubosoft" <grubosoft@xxxxxxxxxxx>
- Date: Sat, 25 Nov 2006 11:20:35 +0100
Hi,
I have made a program in Visual Basic using an MS Access 97 database using
controls available in Visual basic 5 and 6. Now i'm rewriting my program
using ADO Datacontrol integrated in VB6 Professional. I have this problem:
On my form i have several txtFields filled with data from ADO-datacontrol.
The last field is an DataCombo box in combination with a text field. I
lookup in a second ADO-datacontrol for the value out the first datacontrol
en have to disply in the textfield the value from another field out off the
second ADO-datacontrol.
When loading the form I get the data with the following code:
Dim db As DAO.Database
Dim rs As DAO.Recordset
Dim i
Screen.MousePointer = vbDefault
On Error Resume Next
Set db = OpenDatabase(gsDatabase)
Set rs = db.OpenRecordset("Tbl_Vereniging")
rs.Index = "Nummer"
rs.Seek "=", Me.dcVereniging.Text
i = rs.Fields("Naam")
Me.txtFields(13).Text = i
This works fine on opening my form and it displays the right value.
When changing the recordposition i need to update the txtField(13) each time
the end-user using the nextRecord, LastRecord, FirstRecord button.
So on changing the recordposition the textField is not changing until i made
another change to the recordposition. It is always one change later.
I think I need some code in the next sub but i don't know which is right.
Using the code above gives not the right result. Do i forget something ??
Private Sub datPrimaryRS_MoveComplete(ByVal adReason As
ADODB.EventReasonEnum, ByVal pError As ADODB.Error, adStatus As
ADODB.EventStatusEnum, ByVal pRecordset As ADODB.Recordset)
'This will display the current record position for this recordset
datPrimaryRS.Caption = "Record: " &
CStr(datPrimaryRS.Recordset.AbsolutePosition)
End Sub
I'm really appreciating some help.
Thanks in advanced.
Maarten Gruijters
Eindhoven
The Netherlands
NB: I'm sorry for my bad English
.
- Prev by Date: Re: Parameter ?_1 has no default value.
- Next by Date: Using a variable as the data source
- Previous by thread: ADO in multithreaded: Application Verifier (with WinDbg) gives "Invalid Handle" at the end of my application
- Next by thread: Using a variable as the data source
- Index(es):