|
-
November 30th, 1999, 04:15 PM
#1
Field Contents
I have the names of two fields in a database file. I want to get each entry in each field, and I want to do this without using any controls, just coding. How can I achieve this? Thanks.
-
November 30th, 1999, 04:52 PM
#2
Re: Field Contents
In Project, References menu select Microsoft ActiveX Data Objects 2.0 Library. In General Declaration place (Sample works with Sample db Biblio.mdb):
private cn as Connection
private rs as Recordset
In Form_Load event:
private Sub Form_Load()
Dim FirstField 'you need to decide what type
Dim SecondField
set cn = new Connection
cn.CursorLocation = adUseClient
cn.Open "PROVIDER=Microsoft.Jet.OLEDB.3.51;Data Source=C:\Program Files\Microsoft Visual Studio\VB98\Biblio.mdb;"
set rs = new Recordset
rs.Open "select Au_ID,Author from Authors", cn, adOpenStatic, adLockOptimistic
FirstFileld = rs!Au_ID
SecondField = rs!Author
'you have your fields in variables now.
'you can use methods of Recordset object, like MoveNext, MoveLast and so on.
Vlad
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|