Requery a Control

  • Thread starter Thread starter tina
  • Start date Start date
T

tina

if you run the "open a pop-up window to add an item to the droplist" code
from the combo box control's NotInList event, Access will do the requerying
for you. example:

If MsgBox("Add item to list?", vbDefaultButton1 + vbYesNo) = vbYes Then
DoCmd.OpenForm "FormName", , , , , acDialog
Response = acDataErrAdded
Else
Response = acDataErrContinue
Me!ComboBoxName.Undo
Me!ComboBoxName.Dropdown
End If

substitute the correct name of the pop-up form and the correct name of the
combo box control, of course. opening the form with the acDialog setting
causes the code to pause until the form is closed again, then "Microsoft
Access updates the list by requerying the combo box. Microsoft Access then
rechecks the string against the combo box list, and saves the value in the
NewData argument in the field the combo box is bound to." (from the
NotInList Event topic in VBA Help.)

hth
 
Is there a way to list my form in this code, so it opens in ADD mode?

PS - this is really cool, thanks!

tina said:
if you run the "open a pop-up window to add an item to the droplist" code
from the combo box control's NotInList event, Access will do the
requerying
for you. example:

If MsgBox("Add item to list?", vbDefaultButton1 + vbYesNo) = vbYes Then
DoCmd.OpenForm "FormName", , , , , acDialog
Response = acDataErrAdded
Else
Response = acDataErrContinue
Me!ComboBoxName.Undo
Me!ComboBoxName.Dropdown
End If

substitute the correct name of the pop-up form and the correct name of the
combo box control, of course. opening the form with the acDialog setting
causes the code to pause until the form is closed again, then "Microsoft
Access updates the list by requerying the combo box. Microsoft Access then
rechecks the string against the combo box list, and saves the value in the
NewData argument in the field the combo box is bound to." (from the
NotInList Event topic in VBA Help.)

hth


magmike @netterweb.com> said:
to requery a subform, I have the following:

Private Sub Form_Close()
Forms![Rawleads]![Rawleads Date Count].Form.Requery
End Sub

this is on a popup form where the edits/additions affect the data on a
subform on the main form.

i tried this on another popup form, to requery a combo box whose data is
derived from a seperate table, however, i get an error that states this
method doesn't work for this property.

any body know how to requery the choices in the combo box, when the user
adds an item using the popup form that allows them to do so?

thanks!

mike
 
the line of code you need is already there:

DoCmd.OpenForm "FormName", , , , , acDialog

substitute the correct form name for FormName, as i said before. take a look
at the OpenForm Method topic in VBA Help, there's a DataMode argument that
you can use to specify that the form opens as "add only".

hth


magmike @netterweb.com> said:
Is there a way to list my form in this code, so it opens in ADD mode?

PS - this is really cool, thanks!

tina said:
if you run the "open a pop-up window to add an item to the droplist" code
from the combo box control's NotInList event, Access will do the
requerying
for you. example:

If MsgBox("Add item to list?", vbDefaultButton1 + vbYesNo) = vbYes Then
DoCmd.OpenForm "FormName", , , , , acDialog
Response = acDataErrAdded
Else
Response = acDataErrContinue
Me!ComboBoxName.Undo
Me!ComboBoxName.Dropdown
End If

substitute the correct name of the pop-up form and the correct name of the
combo box control, of course. opening the form with the acDialog setting
causes the code to pause until the form is closed again, then "Microsoft
Access updates the list by requerying the combo box. Microsoft Access then
rechecks the string against the combo box list, and saves the value in the
NewData argument in the field the combo box is bound to." (from the
NotInList Event topic in VBA Help.)

hth


"magmike @netterweb.com>" <mike.kline<hates-spam-so-remove-this> wrote in
message news:-p[email protected]...
to requery a subform, I have the following:

Private Sub Form_Close()
Forms![Rawleads]![Rawleads Date Count].Form.Requery
End Sub

this is on a popup form where the edits/additions affect the data on a
subform on the main form.

i tried this on another popup form, to requery a combo box whose data is
derived from a seperate table, however, i get an error that states this
method doesn't work for this property.

any body know how to requery the choices in the combo box, when the user
adds an item using the popup form that allows them to do so?

thanks!

mike
 
Thanks!

tina said:
the line of code you need is already there:

DoCmd.OpenForm "FormName", , , , , acDialog

substitute the correct form name for FormName, as i said before. take a
look
at the OpenForm Method topic in VBA Help, there's a DataMode argument that
you can use to specify that the form opens as "add only".

hth


magmike @netterweb.com> said:
Is there a way to list my form in this code, so it opens in ADD mode?

PS - this is really cool, thanks!

tina said:
if you run the "open a pop-up window to add an item to the droplist" code
from the combo box control's NotInList event, Access will do the
requerying
for you. example:

If MsgBox("Add item to list?", vbDefaultButton1 + vbYesNo) = vbYes Then
DoCmd.OpenForm "FormName", , , , , acDialog
Response = acDataErrAdded
Else
Response = acDataErrContinue
Me!ComboBoxName.Undo
Me!ComboBoxName.Dropdown
End If

substitute the correct name of the pop-up form and the correct name of the
combo box control, of course. opening the form with the acDialog
setting
causes the code to pause until the form is closed again, then
"Microsoft
Access updates the list by requerying the combo box. Microsoft Access then
rechecks the string against the combo box list, and saves the value in the
NewData argument in the field the combo box is bound to." (from the
NotInList Event topic in VBA Help.)

hth


"magmike @netterweb.com>" <mike.kline<hates-spam-so-remove-this> wrote in
message to requery a subform, I have the following:

Private Sub Form_Close()
Forms![Rawleads]![Rawleads Date Count].Form.Requery
End Sub

this is on a popup form where the edits/additions affect the data on a
subform on the main form.

i tried this on another popup form, to requery a combo box whose data is
derived from a seperate table, however, i get an error that states
this
method doesn't work for this property.

any body know how to requery the choices in the combo box, when the user
adds an item using the popup form that allows them to do so?

thanks!

mike
 
you're welcome :)


magmike @netterweb.com> said:
Thanks!

tina said:
the line of code you need is already there:

DoCmd.OpenForm "FormName", , , , , acDialog

substitute the correct form name for FormName, as i said before. take a
look
at the OpenForm Method topic in VBA Help, there's a DataMode argument that
you can use to specify that the form opens as "add only".

hth


"magmike @netterweb.com>" <mike.kline<hates-spam-so-remove-this> wrote in
message news:[email protected]...
Is there a way to list my form in this code, so it opens in ADD mode?

PS - this is really cool, thanks!

if you run the "open a pop-up window to add an item to the droplist" code
from the combo box control's NotInList event, Access will do the
requerying
for you. example:

If MsgBox("Add item to list?", vbDefaultButton1 + vbYesNo) = vbYes Then
DoCmd.OpenForm "FormName", , , , , acDialog
Response = acDataErrAdded
Else
Response = acDataErrContinue
Me!ComboBoxName.Undo
Me!ComboBoxName.Dropdown
End If

substitute the correct name of the pop-up form and the correct name
of
the
combo box control, of course. opening the form with the acDialog
setting
causes the code to pause until the form is closed again, then
"Microsoft
Access updates the list by requerying the combo box. Microsoft Access then
rechecks the string against the combo box list, and saves the value
in
the
NewData argument in the field the combo box is bound to." (from the
NotInList Event topic in VBA Help.)

hth


"magmike @netterweb.com>" <mike.kline<hates-spam-so-remove-this>
wrote
in
message to requery a subform, I have the following:

Private Sub Form_Close()
Forms![Rawleads]![Rawleads Date Count].Form.Requery
End Sub

this is on a popup form where the edits/additions affect the data on a
subform on the main form.

i tried this on another popup form, to requery a combo box whose
data
is
derived from a seperate table, however, i get an error that states
this
method doesn't work for this property.

any body know how to requery the choices in the combo box, when the user
adds an item using the popup form that allows them to do so?

thanks!

mike
 
to requery a subform, I have the following:

Private Sub Form_Close()
Forms![Rawleads]![Rawleads Date Count].Form.Requery
End Sub

this is on a popup form where the edits/additions affect the data on a
subform on the main form.

i tried this on another popup form, to requery a combo box whose data is
derived from a seperate table, however, i get an error that states this
method doesn't work for this property.

any body know how to requery the choices in the combo box, when the user
adds an item using the popup form that allows them to do so?

thanks!

mike
 
Back
Top