A
Anita
I have a Data Entry form (frmLast_Updated). One of my controls is an unbound
drop-down list; when user selects an item from this list, I have AfterUpdate
code to automatically populate a bound control on the form. (I created it
this way because based on the form's underlying query, a bound drop-down
wouldn't display the data I wanted it to display.) When data is typed that is
not in the list, The NotinList Event does not trigger. AfterUpdate triggers
first -- so I have additional code in the AfterUpdate event to open a second
form (frmLast_Updated_Source) where they can add a new record that should
then be able to populate the appropriate bound control in frmLast_Updated.
A word about the second form, frmLast_Updated_Source -- it is based on a
join query and updates two separate tables. After the person enters the data,
they press a "Close" button. As the Close Button code below shows, I am
automatically updating a value in the underlying query, which causes a new
record to be added to one of the underlying join tables.
What I would like to do is save this new record, assign the primary key for
this new record to the appropriate control in the first form and have it
autopopulate with the new data.
What's happening is that the Form 2 record is saving, but Form 1 isn't
recognizing the new data, even if I manually hit Refresh inside of Form 1. It
only finds the new data if I close and reopen.
I researched other posts in this forum and based on those comments added the
DoCmd save record (2nd line of code) below, but I get an error message saying
that the record can't be saved.
Is there a better way to go about this?
Private Sub btnLast_Update_Source_OK_Click()
Me.[notes.descriptor].Value = Me.Source
DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
Forms!Data_Entry_Company!frmLast_Updated![Notes ID].Value =
Me.[Notes ID]
DoCmd.Close acForm, "frmLast_Updated_Source"
Forms!Data_Entry_Company!frmLast_Updated![SourceBound].SetFocus
Forms!Data_Entry_Company!frmLast_Updated![SourceBound].Requery
drop-down list; when user selects an item from this list, I have AfterUpdate
code to automatically populate a bound control on the form. (I created it
this way because based on the form's underlying query, a bound drop-down
wouldn't display the data I wanted it to display.) When data is typed that is
not in the list, The NotinList Event does not trigger. AfterUpdate triggers
first -- so I have additional code in the AfterUpdate event to open a second
form (frmLast_Updated_Source) where they can add a new record that should
then be able to populate the appropriate bound control in frmLast_Updated.
A word about the second form, frmLast_Updated_Source -- it is based on a
join query and updates two separate tables. After the person enters the data,
they press a "Close" button. As the Close Button code below shows, I am
automatically updating a value in the underlying query, which causes a new
record to be added to one of the underlying join tables.
What I would like to do is save this new record, assign the primary key for
this new record to the appropriate control in the first form and have it
autopopulate with the new data.
What's happening is that the Form 2 record is saving, but Form 1 isn't
recognizing the new data, even if I manually hit Refresh inside of Form 1. It
only finds the new data if I close and reopen.
I researched other posts in this forum and based on those comments added the
DoCmd save record (2nd line of code) below, but I get an error message saying
that the record can't be saved.
Is there a better way to go about this?
Private Sub btnLast_Update_Source_OK_Click()
Me.[notes.descriptor].Value = Me.Source
DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
Forms!Data_Entry_Company!frmLast_Updated![Notes ID].Value =
Me.[Notes ID]
DoCmd.Close acForm, "frmLast_Updated_Source"
Forms!Data_Entry_Company!frmLast_Updated![SourceBound].SetFocus
Forms!Data_Entry_Company!frmLast_Updated![SourceBound].Requery