Results 1 to 8 of 8
  1. #1
    Kabethy is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jan 2013
    Posts
    7

    Unhappy error 7802 The command you specified is not available in an .ade database

    Hi guys,

    I have to migrate the following function, among other things this function opens a report in design mode and sets the report to a report variable to change some paper properties, the function works perfect in adp format but when I change it to ade the error 7802 triggers. I did some redn found I am not allow to open a report in design mode when using ade's so how Can I perform the tasks in this format? I am new in access and a simple solution would be much appreciated.

    Thanks a lot for reading my post.
    Public Sub PrintLabel(aLabelQuantity As String)

    On Error GoTo HandleErrors

    Dim rpt As Report
    Dim dm As clsDevMode
    Dim pl As clsPrintLayout
    Dim strParameters As String
    Const conTwipsPerCentimetre As Long = 567
    Dim dm2 As clsDevModeDefaultProperties

    ' Stop the echo
    DoCmd.Echo False

    strParameters = gobjPerson.gstrNumber & ";" & mstrLabelName

    SetReportParameters "rptWwCustomizedLabels", strParameters

    ' Change 003 YM Open the report in design mode not compatible with ade format
    'DoCmd.OpenReport "rptWwCustomizedLabels", acViewDesign

    ' Get reference to the selected label report
    Set rpt = Reports("rptWwCustomizedLabels")
    rpt.PrtDevMode = Nothing
    Set dm = New clsDevMode
    Set dm.Object = rpt
    ' Set the paper properties
    dm.PaperSize = DMPAPER_USER
    dm.PaperLength = mintHeight * 10 + 3
    dm.PaperWidth = mintWidth * 10 + 10
    dm.TrueTypeOption = DMTT_DOWNLOAD
    dm.Save
    Set pl = New clsPrintLayout
    Set pl.Object = rpt
    ' Set the paper properties
    pl.Left = 0.009 * conTwipsPerCentimetre
    pl.Right = 0.009 * conTwipsPerCentimetre
    pl.Top = 0.009 * conTwipsPerCentimetre
    pl.Bottom = 0.007 * conTwipsPerCentimetre
    pl.ItemsAcross = 1
    pl.ItemLayout = mloHorizontal
    pl.DefaultSize = mdsUseWidthAndHeight
    pl.Width = mintWidth / 10 * conTwipsPerCentimetre
    pl.Height = mintHeight / 10 * conTwipsPerCentimetre


    pl.DataOnly = False
    rpt.Section(acDetail).Height = mintHeight / 10 * conTwipsPerCentimetre
    rpt.Width = mintWidth / 10 * conTwipsPerCentimetre + 10
    'Print the report
    'DoCmd.PrintOut
    ' Free variables
    Set pl = Nothing
    Set dm = Nothing
    Set rpt = Nothing
    ' Close report Change 001 YM
    DoCmd.Close acReport, "rptWwCustomizedLabels", acSaveYes

    'Set echo as it was
    DoCmd.Echo True

    ExitHere:
    Exit Sub
    HandleErrors:
    '$Error
    HandleError Err.Number, Err.Description '$Error
    '$Error
    End Sub

  2. #2
    rpeare is offline VIP
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    5,442
    Why do you need to change any of the report setup variables every time you open the report? Once you set the height/width of your margins etc they should remain constant. You're not reading conTwipsPerCentimetre from either user input or a table which seems to be the variable responsible for a lot of your margin/measurement calculations.

  3. #3
    Kabethy is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jan 2013
    Posts
    7
    This is a labeling system I need to readjust the height and width depending on the labels the user choses to print.Also the system is able to create new labels and the users can customize the size and width etc and this report handles these properties before printing the label(report).

    Also the printers are special and a bit old MP0-L-TSP700-THML, MP0-L-SP542-DOT .

    Quote Originally Posted by rpeare View Post
    Why do you need to change any of the report setup variables every time you open the report? Once you set the height/width of your margins etc they should remain constant. You're not reading conTwipsPerCentimetre from either user input or a table which seems to be the variable responsible for a lot of your margin/measurement calculations.

  4. #4
    rpeare is offline VIP
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    5,442
    can you put in some debug.print messages and say where exactly it's failing, that might help narrow it down.

  5. #5
    Kabethy is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jan 2013
    Posts
    7
    It fails when open the report in design mode
    'DoCmd.OpenReport "rptWwCustomizedLabels", acViewDesign

    as this is not allowed in ade format

  6. #6
    rpeare is offline VIP
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    5,442
    http://office.microsoft.com/en-us/ac...005257904.aspx

    saving your Access project as an .ade file compiles all modules, removes all editable source code
    Are you trying to distribute this application to PC's that do not have access installed?

    Or are you simply trying to protect the code that's written from anyone accidentally screwing it up?

    The .ade format specifically removes all options to change the design of any part of your database and is usually associated with distributing software where no version of access is installed (run time components only)

  7. #7
    Kabethy is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jan 2013
    Posts
    7
    Yes is for security reasons.

    I did some research and found maybe I can change properties on the section.onformat event of the report. considering all the properties you have seen I have to change. Do you think this will work? do you have some examples of how to do it? I am new in access programming.

    Thanks for your help

  8. #8
    rpeare is offline VIP
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    5,442
    If your end product is what amounts to a self contained executable file (.mde, .ade) you won't be able to make any design changes at all. what you can do, perhaps, to mitigate people unintentionally messing with the design of your database is to hide all your database objects in the database window and possibly remove the ribbon/toolbar when the database is opened so unless someone knows their way around access they won't have immediate access to the database objects.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 4
    Last Post: 08-08-2012, 10:27 PM
  2. Replies: 2
    Last Post: 07-24-2012, 12:44 PM
  3. Error Import Command Button
    By kowen091010 in forum Access
    Replies: 4
    Last Post: 12-15-2011, 07:56 AM
  4. error 3071 on OpenReport command
    By degras in forum Reports
    Replies: 5
    Last Post: 02-15-2011, 10:40 AM
  5. Replies: 0
    Last Post: 09-11-2006, 07:11 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums