How to open a table or query on top while in a form

  • Thread starter Thread starter Bill Murphy
  • Start date Start date
B

Bill Murphy

I would like to open a table or query while in a form, and have the table or
query appear on top so I can view/edit its contents. But when I use the
following code the forms reappear instantly and the table or query is not
visible. Also, the app is frozen, and the user can't exit. The task has to
be ended.

Any thoughts will be appreciated.

Bill
_____________________________________________

Private Sub cmdOpenLocalTable_Click()

Me.Visible = False
Forms!frmMain.Form.Visible = False

DoCmd.OpenTable Me!cboLocalTables, acViewNormal

Me.Visible = True
Forms!frmMain.Form.Visible = True

End Sub
 
Bill,

I can't figure out the purpose of the Visible = False and True stuff in
your code. But what happens if you remove all of this, and simply have
the one OpenTable line?

By the way, I should also mention that according to local wisdom, tables
and query datasheets are normally regarded as being out of bounds for
human consumption. They are ususally best regarded as background data
storage facilities. For data viewing/editing purposes, you may want to
consider opening another form rather than the table.
 
Steve,

The reason I would like to open these tables and queries in "raw" mode is
that my application is running on a Citrix server, and I do not have
administrative rights on the server to open tables and queries for
inspection and possibly edit. The form in my example below is hidden except
for an administrator in my Access app, so the everyday user will never see
this.

Apparently the tables and queries are opening, but behind any open forms
since I can see them once I shut down the app. The visible = false and
visible = true in my example were an attempt on my part to hide all forms so
that I could see the tables and queries at run time.

The combo boxes that I use to select the tables and queries to open are
populated in my code from the MSysObjects table, so there are a lot of them.
I did not want to have to create a form for each one for viewing/editing.

Bill
 
Bill,

Is the form's Popup property set to Yes? This is the only reason I can
think of why the table being opened is hidden behind the form.
 
Steve,

The form is a popup. There are three forms involved, frmMain which is a
tabbed form, and two popup forms frmAdminContainer and
frmAccessObjectsForAdmin. I found a workaround by minimizing each of these
three forms. I will have to maximize frmAccessObjectsForAdmin manually
after reviewing the table or query, and I added a command button on that
form to restore all three forms. See the code below. If you can think of a
better approach please let me know.

Bill
___________________________________________________________

Private Sub cmdOpenLocalTable_Click()

DoCmd.SelectObject acForm, "frmMain"
DoCmd.Minimize

DoCmd.SelectObject acForm, "frmAdminContainer"
DoCmd.Minimize

DoCmd.SelectObject acForm, "frmAccessObjectsForAdmin"
DoCmd.Minimize

DoCmd.OpenTable Me!cboLocalTables, acViewNormal

End Sub

Private Sub cmdRestoreForms_Click()

DoCmd.SelectObject acForm, "frmMain"
DoCmd.Maximize

DoCmd.SelectObject acForm, "frmAdminContainer"
DoCmd.Maximize

DoCmd.SelectObject acForm, "frmAccessObjectsForAdmin"
DoCmd.Maximize

End Sub
 
Bill,

If you are sure it is necessary for the forms to be popup forms, I guess
your solution is a pretty good one. As a variation on the theme, you
could open a non-popup form before opening the table, and have the
command button to restore the other forms on it rather than on the
frmAccessObjectsForAdmin form. If you do this, I imagine this form will
be sitting there after you close the table, save you the step of
manually maximising the popup?
 
Back
Top