Results 1 to 3 of 3
  1. #1
    4 Star Lounger
    Join Date
    Aug 2001
    Location
    London, UK
    Posts
    516
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Macro Error (access 2000)

    I've got this macro in an access program which is supposed to open a mail merged document if the query is not empty. When I run this it displays an error message saying there are too few parameters in the: Set rst = db.OpenRecordset("ClassicTicket") line, WHY?

    Sub ClassicFax()
    Dim db As DAO.Database
    Dim rst As DAO.Recordset
    Dim objWord As Object
    Set db = CurrentDb
    Set rst = db.OpenRecordset("ClassicTicket")
    If rst.RecordCount = 0 Then
    MsgBox "There are no records", vbOKOnly
    Set rst = Nothing
    Set db = Nothing
    Exit Sub
    Else
    Set objWord = CreateObject("Word.Basic")
    objWord.AppShow
    'objWord.AppMaximize "", 1 (optional)
    objWord.FileOpen "S:SRI_WO~1TRADEA~1classi~2.doc"
    End If
    Set rst = Nothing
    Set db = Nothing
    End Sub

  2. #2
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Macro Error (access 2000)

    Try this instead:

    Set rst = db.OpenRecordset("ClassicTicket", dbOpenSnapshot)

    I assume that ClassicTicket is the name of a query or table, right? You'll also need to do a rst.MoveLast before you can get a recordcount.

    BTW, macros in Access refer to something different from code. We generally refer to code as routines or subs or functions or just "code". I *told* you Access was different. <img src=/S/grin.gif border=0 alt=grin width=15 height=15>
    Charlotte

  3. #3
    4 Star Lounger
    Join Date
    Aug 2001
    Location
    London, UK
    Posts
    516
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Macro Error (access 2000)

    I'm sorry, it wasn't macro error, It was module error.
    It gives me an error on this line now: Set objWord = CreateObject("Word.Basic")
    <img src=/S/angel.gif border=0 alt=angel width=15 height=21>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •