Results 1 to 7 of 7
  1. #1
    Silver Lounger
    Join Date
    Jun 2002
    Location
    Cheadle, Staffordshire
    Posts
    2,177
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Menu Commands (A2k)

    I have the following menu commands buried in one of my form modules:

    DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70
    DoCmd.DoMenuItem acFormBar, acEditMenu, 6, , acMenuVer70

    I want to replace them with the equivelant VBA commands, but can't recognised what they do (I'm just cleaning up my code)

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Menu Commands (A2k)

    The first is equivalent to RunCommand acCmdSelectRecord, but you can omit this one.
    The second is equivalent to RunCommand acCmdDeleteRecord

    See Converting DoMenuItem to RunCommand

  3. #3
    Silver Lounger
    Join Date
    Jun 2002
    Location
    Cheadle, Staffordshire
    Posts
    2,177
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Menu Commands (A2k)

    Hans

    Brilliant link, thanks.
    The menu commands are in my code as you see them, I think from a wizard from a long time ago.
    If as you say, omit the first, why would they have been as they are set out ?

    Private Sub cmdErasePic_Click()
    If Not IsNull([PicFile]) Then
    If MsgBox("The Image Will Be Removed From This Record. Are You Sure?", vbYesNo + vbQuestion) = vbYes Then
    [imgPicture].Picture = ""
    [PicFile] = Null
    [EstimateNo] = Null
    [Supp] = Null
    [Registration] = Null
    [ImageCreated] = Null
    [Comment] = Null
    DoCmd.SetWarnings False
    DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70
    DoCmd.DoMenuItem acFormBar, acEditMenu, 6, , acMenuVer70
    DoCmd.SetWarnings True
    SysCmd acSysCmdClearStatus
    Forms!frmImages.Requery
    Me.lstPreviewJpgs.Requery
    End If
    End If
    End Sub

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Menu Commands (A2k)

    The menu instructions are from AccessBasic in Access 95; they don't always translate one-to-one to Visual Basic for Access 97 and up. It is not really necessary to select the entire record before deleting it.

  5. #5
    Silver Lounger
    Join Date
    Jun 2002
    Location
    Cheadle, Staffordshire
    Posts
    2,177
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Menu Commands (A2k)

    Again Thanks

  6. #6
    Platinum Lounger
    Join Date
    Dec 2001
    Location
    Melbourne, Australia
    Posts
    4,594
    Thanks
    0
    Thanked 27 Times in 27 Posts

    Re: Menu Commands (A2k)

    Didn't Access Basic die with Access 2, and VBA introduced with A95? I know it really doesn't matter, but....

  7. #7
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Menu Commands (A2k)

    You're correct, the programming language in Access was called Access Basic in versions 1 and 2; Access 95 and up use VBA; however, the dialect in Access 95 shows its heritage in Access Basic, for instance in DoMenuItem.
    Strangely enough, some of the Wizards in Access 2002 still create antiquated code using DoMenuItem, though RunCommand with arguments for menu options has been available since Access 97.

Posting Permissions

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