![]() |
#1
|
|||
|
|||
![]()
I wrote, and have been using, Word VBA for some time with an early version of Access (.mdb suffix), and all works fine. I want to change it to use the current Access .accdb suffix. I've tried just changing the suufix from .mdb to .accdb but that gives an error "User defined type not defined" when it tries to execute "dbs As DAO.database".
Any help will be very much appreciated as I'm now out of my depth! Relevant scraps of code are shown below. Option Explicit Dim MasterDbDrive As String Private Sub UserForm_Initialize() MultiMaxCount = 10 ' maximum prints that can be held before printing 'NetworkReply = 0 MasterDbDrive = "C:" ' set to C: for testing on a local PC RootFolder = MasterDbDrive + "\Helpline Docs\Standard Letters\" MasterFolder = RootFolder & "Master copies\" 'path of master documents PrevFolder = RootFolder & "Previous versions\" 'to save previous letter MasterDb = MasterFolder & "Standard Letters.mdb" FFUI_Start: On Error GoTo FFUIerr1 ChDrive MasterDbDrive GoTo FFUIerr1x ----------------------------------------------------------------------------------------------------- Private Sub WriteToDB() Dim dbs As DAO.database Dim rst As DAO.recordset Set dbs = OpenDatabase(Name:=MasterDb) Set rst = dbs.OpenRecordset(DbTable, dbOpenTable) With rst .AddNew .Fields("Addressee") = FrmMainB.Addressee .Fields("Position") = FrmMainB.Position .Fields("Organisation") = FrmMainB.Organisation .Fields("Address1") = FrmMainB.Address1 .Fields("Address2") = FrmMainB.Address2 .Fields("Address3") = FrmMainB.Address3 .Fields("Address4") = FrmMainB.Address4 .Fields("PostCode") = FrmMainB.PostCode .Fields("Salutation") = FrmMainB.Salutation .Update End With rst.Close dbs.Close Set rst = Nothing Set dbs = Nothing End Sub |
![]() |
Tags |
.accdb access word vba |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
![]() |
oshkosh | PowerPoint | 3 | 04-05-2016 06:10 AM |
![]() |
tejaspareek | Word VBA | 4 | 11-04-2014 05:50 AM |
Auto update image in a PowerPoint file | expert4knowledge | PowerPoint | 0 | 05-28-2012 06:04 PM |
![]() |
Peter J. Veger | Mail Merge | 1 | 02-23-2012 10:42 PM |
![]() |
Jamal NUMAN | Word | 2 | 01-06-2011 02:43 PM |