Unanswered: Why is Access opening my report *behind* my forms?
I have a basic form and a basic report. On my form I have two text boxs for a date range (a start date and an end date) and a button. When the button is pressed the report is opened (through some simple Visual Basic). However, when the report is opened, it's placed BEHIND all of the on-screen forms and the only way to get to it is to MOVE the form windows around...
Here is the code that opens the report:
Private Sub Command0_Click()
On Error GoTo Err_Command0_Click
Dim stDocName As String
Dim strWhere As String
strWhere = strWhere & " AND satDown=true "
If Len(Me.fromDate & "") > 0 And Len(Me.toDate & "") > 0 Then
strWhere = strWhere & " AND dateofreferral Between #" & CDate(Me.fromDate) & "# AND #" & CDate(Me.toDate) & "#"
strWhere = strWhere & " AND dateofreferral Between #" & Date & "# AND #" & Date & "#"
stDocName = "Sits Report"
If Len(strWhere & "") = 0 Then
DoCmd.OpenReport stDocName, acViewPreview
DoCmd.OpenReport stDocName, acViewPreview, WhereCondition:=Mid(strWhere, 6)
To be honest, I'm a software developer but I use Delphi (for web-apps only [stand-alone CGI .exes]) and MS SQL, so I'm not too familiar with MS Access.
I designed this simple database for my father about a year ago so I completely forget why I did what I did... (of course, it could be that I didn't know what I was doing...)
Currently the main form in the database is set to "Pop-Up: Yes" and "Modal: No". I'm not sure why I did this, but I have Access set open my main form whenever the database is opened and I have all of the other controls hidden... (so my father can't accidentily "redesign" any forms or anything like that).
Should I change the Pop-Up and Modal settings to something else? What about the other forms? (on my main form I have buttons that open the other, smaller, forms)
You can change the Pop-Up to "No", but that will change the way the form interacts with the desktop and with other forms.
Basically, you have to live with the report previews being behind your form, or live with your form not always being on top of other forms. You can't set it to be "on top of all other forms, but beneath print preview windows".
If it's not practically useful, then it's practically useless.