Problems in Access 2007, but not 2003

Sorry I still get the error "Property not found" when I try your way Bob. Can you post the whole code?

As far as "Docmd.OutputTo " I find that I can produce a PDF of the screen but there are a number of steps, such as saving the file name etc which I'd rather avoid!
 
There's no other code to what Bob gave you. Where are u running the code from? A button that is in a form?

For the Docmd.Output metho, are you referring to allowing users choose that path and saving the document to that path? Here's a link that would help with this:

http://www.cpearson.com/excel/BrowseFolder.aspx
 
Sorry I still get the error "Property not found" when I try your way Bob.
Did you use my code EXACTLY as written, or did you modify it in any way at all? It should work EXACTLY as written:

DoCmd.OpenForm Me.Name, acPreview
 
I actually have the same issue right now, though for me, it was working in Access 2010 until I changed the window layout from popup windows to tabs. With popup windows, Docmd.OpenForm formName, acPreview works just fine. When I changed it to tabs, I got the same error you got, Error 3270 - Property not found.

There are two workarounds for this. If you do a Docmd.Close acForm, formName, acSaveYes right before this command, then it works fine. However for me, I do some form formatting (font color changes) so this doesn't help me out.

The other workaround is to make a dropdown box (below, cboLayout) on your main switchboard with the option to switch between the two window layout styles. Tie the following code to it's AfterUpdate:

Code:
Private Sub cboLayout_AfterUpdate()
    Dim tempDB As DAO.Database
 
    If SysCmd(acSysCmdAccessVer) >= 12 Then
        Set tempDB = CurrentDb
        If Me!cboLayout.Value > 0 Then
            tempDB.Properties("UseMDIMode") = 1  '1 = overlapping windows
        Else
            tempDB.Properties("UseMDIMode") = 0  '0 = tabbed documents
        End If
        Call MsgBox("You must restart the database for the changes to take effect. " & Chr(13) & "This will affect all users of the database.", _
            vbOKOnly, "Restart Required")
    End If
Exit_Point:
    Set tempDB = Nothing
    Exit Sub
Err_Handler:
    If Err.Number = 3270 Then
        Dim prp As DAO.Property
 
        Set prp = tempDB.CreateProperty("UseMDIMode", dbByte, Nz(Me!cboLayout.Value, 0))
        tempDB.Properties.Append prp
        Set prp = Nothing
        Resume Next
    Else
        MsgBox Err.Number & "-" & Err.Description
        Resume Exit_Point
    End If
End Sub

For me it's annoying that users will be reverted over to window popup view mode whenever someone wants to print a form. But it's the only fix, unless anybody else knows an alternative that'll allow formatting of text after Docmd.OpenForm formName, acPreview is called.
 
Great news, I found a way to get it working with tabular view. Apparently, DoCmd.RunCommand acCmdPrint still works. So instead of opening the form in acPreview mode, just tell it to directly print.
 

Users who are viewing this thread

Back
Top Bottom