access form refresh question. killing me!

L

lyledentale

hey guys - i am here at work creating a db and all is going well but for one
thing.
i have an input form that uses combo boxes. in these combo boxes are
different lists of vendors, items etc.
when a choice is not present for the user to input they click on a form that
opens up a form that allows them to add to the list.
the problem is - when the person closes the add to combo list form and goes
back to the input form - the list is not updated. when you refresh the
record is then saved without full input.
what do i do?

how can i update the combo list in input form without refreshing or opening
form and closing? i do not want to lose that info. thanks guys!
 
S

schasteen

On the close event of your add combo form put the code like

Forms![InputForm]![comboBox].requery

This will requery the source of the data for the combo box and show the new
entry.
 
G

Gina Whipp

In the On Click event of the combo box I use DoCmd.Requery
"NameFoYourComboBox"

This wasy after the user inputs the new item my combo box refreshes...

HTH
 
L

lyledentale

is this correct format?

Forms![INPUT_FRM]![MFG].requery

thanks so much man.

doesnt work yet but i know it will!

also this is on the event "on exit".

schasteen said:
On the close event of your add combo form put the code like

Forms![InputForm]![comboBox].requery

This will requery the source of the data for the combo box and show the new
entry.



lyledentale said:
hey guys - i am here at work creating a db and all is going well but for one
thing.
i have an input form that uses combo boxes. in these combo boxes are
different lists of vendors, items etc.
when a choice is not present for the user to input they click on a form that
opens up a form that allows them to add to the list.
the problem is - when the person closes the add to combo list form and goes
back to the input form - the list is not updated. when you refresh the
record is then saved without full input.
what do i do?

how can i update the combo list in input form without refreshing or opening
form and closing? i do not want to lose that info. thanks guys!
 
S

schasteen

Looks correct. Let me know if there are any problems

lyledentale said:
is this correct format?

Forms![INPUT_FRM]![MFG].requery

thanks so much man.

doesnt work yet but i know it will!

also this is on the event "on exit".

schasteen said:
On the close event of your add combo form put the code like

Forms![InputForm]![comboBox].requery

This will requery the source of the data for the combo box and show the new
entry.



lyledentale said:
hey guys - i am here at work creating a db and all is going well but for one
thing.
i have an input form that uses combo boxes. in these combo boxes are
different lists of vendors, items etc.
when a choice is not present for the user to input they click on a form that
opens up a form that allows them to add to the list.
the problem is - when the person closes the add to combo list form and goes
back to the input form - the list is not updated. when you refresh the
record is then saved without full input.
what do i do?

how can i update the combo list in input form without refreshing or opening
form and closing? i do not want to lose that info. thanks guys!
 
W

wsnzhvv7o7k002

Another thing I sometimes do in cases like this is to add this code to
the button click event of the button that opens the "Add Vendor" form:

Private Sub cmdOpenAddVendor_Click()
DoCmd.OpenForm "AddVendor", , , , , acDialog
Me.cboVendorsCombo.Requery
End Sub

In the DoCmd.OpenForm, by setting the WindowMode argument to "acDialog"
that makes the "AddVendor" form to open as a modal dialog box (doesn't
let you click on anything else in Access) and tells the
cmdOpenAddVendor_Click() event to stop executing code until the
"AddVendor" form closes. After it closes then it will continue on to
the Me.cboVendorsCombo.Requery line which will requery the combo box.
You might need to experiment with the "PopUp" and "Modal" properties of
the "AddVendor" form, I don't remember if it matters how these are set.

Earlier Gina Whipp mentioned adding "DoCmd.Requery" to the OnClick
event of the combo box. This would work, but it would cause a lot of
unnecessary Requeries because every time you clicked on the combo box
it would requery. You really only need to requery when you have added
a new entry. Although I guess if it is a shared database and you may
have several different people adding Vendors then it may not be a bad
idea. In that case I sometimes do it in the Form_Current() event. You
really don't need to do a DoCmd.Requery, that would requery the entire
form, I would just do a Me.cboVendorCombo.Requery, that would pull down
less data.

Greg
 
L

lyledentale

thanks so much guys - i think we got something here with combo box refresh.
i swear you are all geniuses.
 
L

lyledentale

greg - thanks so much. here is the code i put in.

no debugger comes up but i do get a "object required" pop up after.

then when i go back to input form - in order for me to see new combo entry -
i need to click in field to refresh.

thanks!

Private Sub Command45_Click()
On Error GoTo Err_Command45_Click

Dim stDocName As String
Dim stLinkCriteria As String

DoCmd.OpenForm "ADD_MFG_FRM", , , , , acDialog
INPUT_FRM.MFG.Requery

stDocName = "ADD_MFG_FRM"
DoCmd.OpenForm stDocName, , , stLinkCriteria

Exit_Command45_Click:
Exit Sub

Err_Command45_Click:
MsgBox Err.Description
Resume Exit_Command45_Click

End Sub
 
G

Gina Whipp

Although I guess if it is a shared database and you may
have several different people adding Vendors then it may not be a bad
idea.

That's precisely why I do it but I do see your point if only a couple of
users why requery everytime you click the comb box...
 
S

schasteen

Change INPUT_FRM.MFG.Requery to Me.MFG.Requery. Why do you open the
ADD_MFG_FRM form twice? You can remove the second.
 
E

Ebitari

I am trying to get the combo box to refresh after each record in a table.
When I use this command below in the On Click event it does not work.

Should the name of the combo box in the code be inside double brackets like
that? Did I write it wrong? The name of my combo box is "WBS". Would the
code be:

DoCmd.Requery "WBS"
 
Top