Transferring data from a dialog box to a form

G

Guest

A command button on my main form calls up a dialog box. The dialog box
prompts the user to enter data, and then runs a macro when the dialog box is
closed. However, the changes made in the dialog box do not appear
subsequently on the main form, even if I add a refresh or requery command to
the macro (or both). I can refresh manually, but I get a "write conflict"
error. If I respond to this error by dropping changes, then the main form
updates to the new data. Interestingly, if I subsequently call up the dialog
box again while leaving the main form open, it works properly on all but the
first time. Is there a way to program the computer to automatically accept
the changes from the dialog box and overwrite the data open on the main form,
then requery/refresh the main form so it displays properly?
 
H

hermie

Hi
Can you not simply enter the data in the mainform? What is the use of the
dialog box?

herman
 
G

Guest

The macro attached to the dialog box has other functions which restrict the
users' abilities to make certain changes, check other data before allowing
changes, lock out illogical data changes, and so forth. These functions are
the purpose of the dialog box. I didn't mention them in my earlier post,
because they're working OK.

Any thoughts on the main question?

sjk
 
G

Guest

Hi sjk,

I get the impression that the main form and the dialog are trying to edit
the same record. If this is the case you will have to re-think through the
input/edit process.

Alternatively, pass to the dialog the values that are required for the
dialog to do its thing. Then pass back to the main form values from the
dialog.

Luck
 
G

Guest

Yes, that's it exactly. The dialog and the main form are both trying to edit
the same record. I want access to understand that it should automatically
accept the values chosen in the dialog box, without requiring the user to
respond to a warning box. How do I "pass back to the main form values from
the dialog"?

Thanks for your help, Jonathan

sjk
 
A

Albert D. Kallal

Yes, that's it exactly. The dialog and the main form are both trying to
edit
the same record. I want access to understand that it should automatically
accept the values chosen in the dialog box, without requiring the user to
respond to a warning box. How do I "pass back to the main form values
from
the dialog"?

All you have to do is RIGHT BEFORE you launch the 2nd form, is force a disk
write

me.Refresh
docmd.Openform "your 2nd form".....

When the 2nd form closes, you will see the updates..and no conflict will
occur...
 

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