Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Modules / DAO / VBA / November 2006

Tip: Looking for answers? Try searching our database.

requery combo box in subform

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
scotbcb - 17 Jan 2006 14:55 GMT
Have a form with a subform containing a combo box. If the value entered is
not in the table behind the combo box the user is prompted to enter new
values. If Yes then a new form is opened and the new values are entered into
the table via the form. When the form is closed and you are returned to the
origional form the combo box does not show the new values entered. I have
tried the requery method in a number of events on different forms but am not
abole to find a solution. Please help.
Ofer - 17 Jan 2006 17:07 GMT
On the After update event of the second form or the UnLoad event, try and run
the requery

Forms![Form1Name]![Combo Name].Requery

Signature

\\// Live Long and Prosper \\//
BS"D

> Have a form with a subform containing a combo box. If the value entered is
> not in the table behind the combo box the user is prompted to enter new
[quoted text clipped - 3 lines]
> tried the requery method in a number of events on different forms but am not
> abole to find a solution. Please help.
scotbcb - 17 Jan 2006 17:23 GMT
Tries this and get:

Error 2118
You must save the current field before you run the requery action

> On the After update event of the second form or the UnLoad event, try and run
> the requery
[quoted text clipped - 8 lines]
> > tried the requery method in a number of events on different forms but am not
> > abole to find a solution. Please help.
Ofer - 17 Jan 2006 17:46 GMT
Then try and run this line of code before, to save the record

DoCmd.RunCommand acCmdSaveRecord

Signature

\\// Live Long and Prosper \\//
BS"D

> Tries this and get:
>
[quoted text clipped - 13 lines]
> > > tried the requery method in a number of events on different forms but am not
> > > abole to find a solution. Please help.
scotbcb - 17 Jan 2006 18:02 GMT
Still getting same error is the issue because I have the combo boxes in
subforms on the main form?

> Then try and run this line of code before, to save the record
>
[quoted text clipped - 17 lines]
> > > > tried the requery method in a number of events on different forms but am not
> > > > abole to find a solution. Please help.
Brian Bastl - 18 Jan 2006 03:20 GMT
You need to set the "Response". Your code should look something like this:

Private Sub Whatever_NotInList(NewData As String, Response As Integer)

   if msgbox ("bla bla bla", vbYesNo) = vbYes then
       Docmd.Openform "YourForm",,,, acFormAdd, acDialog, NewData
       Response = acDataErrAdded    'combo automatically requeried
   else
       Response = acDataErrContinue
       me.undo
   end if

End Sub

HTH,
Brian

> Have a form with a subform containing a combo box. If the value entered is
> not in the table behind the combo box the user is prompted to enter new
[quoted text clipped - 3 lines]
> tried the requery method in a number of events on different forms but am not
> abole to find a solution. Please help.
Dave14117 - 23 Nov 2006 01:19 GMT
I am having same problem trying to add an entry to a combo list from a
NotInList event procedure. While I thing the responders are right that
acDataErrAdded will requery, I wonder if that only works if the update is
made within the event proc. -- not if the update is made partly by the event
proc (NewData) and also partly by opening up a new form.  I.e. my addition
needs several fields filled in, while only one of course kicks off the
NotInList. Is there a way to do this?
Signature

Thanks,

Dave

> Have a form with a subform containing a combo box. If the value entered is
> not in the table behind the combo box the user is prompted to enter new
[quoted text clipped - 3 lines]
> tried the requery method in a number of events on different forms but am not
> abole to find a solution. Please help.
Ken Snell (MVP) - 23 Nov 2006 03:24 GMT
Works either way, but be sure that you open the second form in Dialog mode
so that the code pauses until the second form is closed. In fact, it's
usually better to save the data to the table in the second form, do the
requery there, and then close the second form.

Signature

       Ken Snell
<MS ACCESS MVP>

>I am having same problem trying to add an entry to a combo list from a
> NotInList event procedure. While I thing the responders are right that
[quoted text clipped - 16 lines]
>> not
>> abole to find a solution. Please help.
Dave14117 - 23 Nov 2006 05:08 GMT
Haven't heard of Dialog.  Sounds good.  I'll try it
Signature

Thanks,

Dave

> Works either way, but be sure that you open the second form in Dialog mode
> so that the code pauses until the second form is closed. In fact, it's
[quoted text clipped - 21 lines]
> >> not
> >> abole to find a solution. Please help.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.