acDialog not working properly

  • Thread starter Cyberwolf via AccessMonster.com
  • Start date
C

Cyberwolf via AccessMonster.com

I have the following code that opens as many as 5 different forms based on
the selected items in the list box. It does not stop code execution on each
form open, it just opens all of the forms at the same time.

Private Sub cmdOpen_Click()
Dim varItem As Variant

On Error GoTo cmdOpen_Click_Error

Me.Visible = False
For Each varItem In Me.lstSegTables.ItemsSelected
DoCmd.OpenForm (Me.lstSegTables.ItemData(varItem)), acFormDS, , ,
acFormAdd, acDialog
Next varItem
Me.Visible = True

On Error GoTo 0
Exit Sub

cmdOpen_Click_Error:

MsgBox "Error " & Err.Number & " (" & Err.Description & ") in procedure
cmdOpen_Click of VBA Document Form_Form1"
End Sub

Also, the forms do not open properly. In this I meam the do not open like
other forms I have set to open with acDialog. They open very small. All
you can see is the "X" used to close and part of the 1st field in the form.

Any help would be appreciated.

TIA,
 
A

Albert D. Kallal

As far as I know, You can't open a form in datasheet mode, and have a
dialogue it the same time....

You'll likely have to make the forms continuous forms.

if you absolutely must use data sheets, then you're gonna have to have the
close event of the datasheet call your code to launch the next form, as
you'll not be able to have the calling code "wait" by using a dialog
form....

Perhaps a better approach would be to display all the forms in a list box on
a form. This would allow the user to click on each entry in the list box to
launch the form in datasheet mode, and then when they close that form, they
would be back at this form with the listed box to select the next form they
are supposed to operate on.
 
L

Linq Adams via AccessMonster.com

DoCmd.OpenForm (Me.lstSegTables.ItemData(varItem)), acFormDS, , ,
acFormAdd, acDialog

The problem is you're trying to open your forms in both Datasheet mode and
Dialog mode, and Access doesn't allow this. When you open forms in Datasheet
mode you give up much of the normal functionality allowed forms. In Design
View, for instance, you can do all kinds of formatting things, add unbound
controls and such, and when you open the form in Datasheet view (acFormDS)
all these things disappear. Since you're opening these form in DS view, the
acDialog idn't really invoked, and the code in the original form is not
suspended as it normally would be.

I'm not sure, but the problem with all of the forms opening small could be
related to this also. Opening five forms at once seems, in itself, rather
strange.
 
D

David W. Fenton

As far as I know, You can't open a form in datasheet mode, and
have a dialogue it the same time....

But you can open a form in dialog mode that has a subform on it that
is in datasheet mode. The main form would be unbound and serve no
purpose other than to allow you to open the datasheet form modally.
 
C

Cyberwolf via AccessMonster.com

I had a feeling that was wht it was, but hey you never know until you ask.

Thanks Albert. BTW, I have used a lot of the suggestions from your site.
Great stuff!!!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top