Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Access to Word using vba 1

Status
Not open for further replies.

Salmano

Programmer
Oct 4, 2001
34
RO
Hi !
In Access (97), I have a linked table (DBF)...
In Word (97), using VB code, I open the access database and make a record set from the linked table. The data resulting is included in a combo box (in a form) but, here is the problem, the recordcount of the record set is not the record count in the table... it is always 1; so, the recordset has only one row of data, and the linked table has a lot more than that !
I tried also using a query in access and open the record set on it, but I obtained the same result...

I would appreciate any sugestion... Thanks !
 
The problem maybe that you are not populating the recordset. Try:

rs.movelast
rs.movefirst

where rs is your recorset var.

Nick
 
Try this way :

Dim MyDB as Database
Dim RecSet as Recordset
Dim SQLStr as String

Set MyDB = OpenDatabase(&quot;<database_path_&_name>.mdb&quot;)
SQLStr = &quot;select * from <table_name>&quot;
Set RecSet = OpenRecordset(SQLStr)

With RecSet
.MoveLast
X = .RecordCount
.MoveFirst

...
...
...
...
...
End With
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top