Home |
Search |
Today's Posts |
#1
|
|||
|
|||
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 | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Importing a customized Word toolbar from a different user account | Microsoft Word Help | |||
Importing single values from an Access database into a Word docume | Microsoft Word Help | |||
Importing Works Database into Word Address Book | Microsoft Word Help | |||
Importing data from a database (Excel or Access) into Word documen | Microsoft Word Help | |||
importing access database | Microsoft Word Help |