Modal form passes sequence without waiting?

N

news2

This MUST be simple.

I have a modal form that asks for entry of one field and has an OK button.

For the only field on the form I have a got-focus sub to load the field with
a default value.

The OK button has a sub to move the contents of the field to an external
public variable and then docmd.close.

What happens is that when the form is opened with

DoCmd.OpenForm "<name of the form>", acNormal

the calling procedure continues to the succeeding statement without waiting
for the form's OK to be hit. The form remains visible.

Hints????

Dick
 
S

storrboy

This MUST be simple.

I have a modal form that asks for entry of one field and has an OK button.

For the only field on the form I have a got-focus sub to load the field with
a default value.

The OK button has a sub to move the contents of the field to an external
public variable and then docmd.close.

What happens is that when the form is opened with

DoCmd.OpenForm "<name of the form>", acNormal

the calling procedure continues to the succeeding statement without waiting
for the form's OK to be hit. The form remains visible.

Hints????

Dick

Hint - acDialog.
 
D

Dirk Goldgar

In
This MUST be simple.

I have a modal form that asks for entry of one field and has an OK
button.

For the only field on the form I have a got-focus sub to load the
field with a default value.

The OK button has a sub to move the contents of the field to an
external public variable and then docmd.close.

What happens is that when the form is opened with

DoCmd.OpenForm "<name of the form>", acNormal

the calling procedure continues to the succeeding statement without
waiting for the form's OK to be hit. The form remains visible.

Hints????

Dick

You need to open it explicitly in dialog mode:

DoCmd.OpenForm "<name of the form>", WindowMode:=acDialog
 
N

news2

Thanks, that did it. An earlier suggested solution worked but the compiler
complained.

Dick
 

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