Comments inline...
--
Ken Snell
<MS ACCESS MVP>
llaxmi said:
Hi Ken
Well, enough of this for the weekend! I can't tell you how much I
appreciate your input. Have a great weekend. When you return, here is
some
info that may help....
What I mean is that the form's Recordsource property (in Properties window)
contains the name of a table, the name of a query, or an SQL statement. And
that the controls on the form have the name of one of those fields in the
Control Source property of the control.
Here is a description of the complete form that may
help to clarify...
The form (which populates a single table) has 2 command buttons, one to
return the user to the switchboard and the other to exit and close access.
It
has a one-to-many relationship linked by an auto number field.
So it does seem that your form has a Recordsource that should be the name of
a table.
There are several combo boxes for items like customers, branches and etc.,
used for data integrity. The other fields are fill-in type fields (qty,
date
etc.).
And it does seem that the controls are bound to fields in the form's
recordsource.
The form also has a subform which populates a single table. It is
just a simple table for data entry of barcode numbers and dates.
Ahhh... more on this later.
Here's what works/doesn't:
clicking close and exit command button returns prompt
clicking the form window "x" button returns the prompt
clicking file|close returns the prompt
clicking the return to switchboard button does not
Upon reading through your posted code again, it appears that I may have
misunderstood which procedure is the one for this action. I see a
"returntoswitchboard_Click" procedure, which is what I assumed was the code
for this button. But I also see "returntomenu_Click" procedure, which also
seems to be designed to "return" to a switchboard. If the former is the code
that runs when you click the "return to switchboard" button, the message
should appear. If the latter is the code that runs when you click the
"return to switchboard" button, the message will not appear because you're
not telling the form to save its data before you open a new form over the
top of this form.
clicking the close and exit button on the switchboard form returns the
prompt
clicking a field in the subform returns the prompt
tabbing into the subform does not return a prompt
This action will not prompt you with the message unless you changed data in
one of the "bound" controls on the main form before tabbing into the
subform.
changing/adding a record in the subform and then clicking backinto the to
the main form and clicking any of the above does not return a prompt
changing/adding a record in the subform and then clicking backinto the to
the main form and then tabbing into the next field does return a prompt
when
clicking on the buttons as above.
Both of the above actions are changes to the subform's data, not to the main
form's data. The code that we discussed earlier is designed to work for the
main form's data only; that is because you put the code in the main form's
BeforeUpdate event.