Reply
 
Thread Tools Display Modes
  #1   Report Post  
Mdmax Mdmax is offline
Junior Member
 
Posts: 2
Default Importing mdb database into user form

Hi,
I have a user form that creates an msword report, it connects to an access2000 database called Docs.mdb, the 7 fields within the "Docs" table a Last, Name, Credential, Number, Building, City, State, zip.

The code works perfectly in the user form and brings up all the relevant fields, but when I click the OK button, only the "last name" of the doctor appears on my report (and all the other fields are left out, for some reason).

The code I am using is within the: Private Sub UserForm_Initialize()/end sub statement

(enabled library is: “Microsoft DAO 3.6 Object Library”)

Dim db As DAO.Database
Dim rs As DAO.Recordset
Dim NoOfRecords As Long
'Open the database to retrieve data
Set db = OpenDatabase("C:\Databases\Docs.mdb")
'Define the first recordset
Set rs = db.OpenRecordset("SELECT * FROM Docs ORDER BY [Last]")
'Determine the number of records in the recordset
With rs
.MoveLast
NoOfRecords = .RecordCount
.MoveFirst
End With
'Set the number of ListBox columns = number of fields in the recordset
ComboBoxDocs.ColumnCount = rs.Fields.Count
'Load the ListBox with the retrieved records
ComboBoxDocs.Column = rs.GetRows(NoOfRecords)
'Cleanup
rs.Close
db.Close
Set rs = Nothing
Set db = Nothing

How can I get the final report (an msword.doc, with a bookmark "alldocs", for the combobox entry text), to display all the rest of the other (above) fields, and not just the last name?...

Thank you.
Reply
Thread Tools
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Importing a customized Word toolbar from a different user account Sinh Trinh Microsoft Word Help 1 September 24th 08 10:42 AM
Importing single values from an Access database into a Word docume RichMark Microsoft Word Help 1 October 26th 07 01:36 PM
Importing Works Database into Word Address Book Patrick Microsoft Word Help 4 December 17th 06 03:24 AM
Importing data from a database (Excel or Access) into Word documen kiwi Microsoft Word Help 3 May 22nd 06 08:59 PM
importing access database marty Microsoft Word Help 2 March 28th 05 02:35 PM


All times are GMT +1. The time now is 06:26 PM.

Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 Microsoft Office Word Forum - WordBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Word"