By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,825 Members | 1,708 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,825 IT Pros & Developers. It's quick & easy.

Update a Listbox after making a change in a field

P: n/a
Hello... thank you for your time.

I have a form that has a List box of equipotent records and a sub form
that will show the data of the equipment select from the list box.

Is it possible to make a change in the name field in the details, then
refresh the list box with new name?

Please help and thanks!

N. Graves
Nov 12 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
N. Graves wrote:
Hello... thank you for your time.

I have a form that has a List box of equipotent records and a sub form
that will show the data of the equipment select from the list box.

Is it possible to make a change in the name field in the details, then
refresh the list box with new name?

Please help and thanks!

N. Graves


If refreshing in the main form, and the listbox is called LB1, then
Me.LB1.Requery
If the LB is in a main form but called to refresh from a subform
Forms!MainForm!LB1.Requery

Nov 12 '05 #2

P: n/a
Thanks you so much for your input. I think I need to add a little
more to my disruptions. First here is the code that I'm using

Private Sub CommonName_AfterUpdate()
Forms!frm_AddEdit_Equipment_Master.lst_EquipID.Req uery
End Sub

Action: When I update this field and move to another field the screen
will flicker like it is refreshing but nothing happens... If I go
back to the field and change it again and leave then the list box will
update but it displays the first change and not the last change.

I'm guessing that I need to update the record (save the record) before
I update the list box. I have search help but not able to find the
command to post the changes to the table before I refresh.

Can you help me?

Thanks again!

N. Graves

On Thu, 20 May 2004 21:02:27 GMT, Salad <oi*@vinegar.com> wrote:
N. Graves wrote:
Hello... thank you for your time.

I have a form that has a List box of equipotent records and a sub form
that will show the data of the equipment select from the list box.

Is it possible to make a change in the name field in the details, then
refresh the list box with new name?

Please help and thanks!

N. Graves


If refreshing in the main form, and the listbox is called LB1, then
Me.LB1.Requery
If the LB is in a main form but called to refresh from a subform
Forms!MainForm!LB1.Requery


Nov 12 '05 #3

P: n/a
N. Graves wrote:
Thanks you so much for your input. I think I need to add a little
more to my disruptions. First here is the code that I'm using

Private Sub CommonName_AfterUpdate()
Forms!frm_AddEdit_Equipment_Master.lst_EquipID.Req uery
End Sub
Action: When I update this field and move to another field the screen
will flicker like it is refreshing but nothing happens... If I go
back to the field and change it again and leave then the list box will
update but it displays the first change and not the last change.
I'm guessing that I need to update the record (save the record) before
I update the list box. I have search help but not able to find the
command to post the changes to the table before I refresh.
That would appear to be correct if the listbox's rowsource are records
in a table and not a value list or user defined list. If you haven't
committed the changes (saved record) and the rowsource is from a table,
it certainly is not going to have that in the listbox.

You could enter a command like
Me.Dirty = False
to save the record just prior to requerying. Another option is to put
the Requery in the AfterUpdate event of the form...IOW, after the record
has been saved. I don't know why it needs to be in the listbox
immediately after a field is changed.

If you absolutely, positively need to have this when the field changes
and not when the record changes you have a couple of options....make the
rowsource a value list and concatenate the data to display. There is a
caveat using this method...I think the string length for a value list is
2048 so you can't display too many rows. Or, write a UserDefine
function. If you are willing to futz with that (maybe do some searches
at Google groups, *Access*, for userdefine callbacks, you should get
plenty of code to assist.


Can you help me?

Thanks again!

N. Graves

On Thu, 20 May 2004 21:02:27 GMT, Salad <oi*@vinegar.com> wrote:

N. Graves wrote:

Hello... thank you for your time.

I have a form that has a List box of equipotent records and a sub form
that will show the data of the equipment select from the list box.

Is it possible to make a change in the name field in the details, then
refresh the list box with new name?

Please help and thanks!

N. Graves


If refreshing in the main form, and the listbox is called LB1, then
Me.LB1.Requery
If the LB is in a main form but called to refresh from a subform
Forms!MainForm!LB1.Requery



Nov 12 '05 #4

P: n/a
Thank you for your insight!

That worked with the Dirty = False.

I have posted another question title "Tab Control Display issue" If
you have an extra moment to take a look and response. I'll owe you a
one

Thanks

N. Graves

On Fri, 21 May 2004 17:27:50 GMT, Salad <oi*@vinegar.com> wrote:
N. Graves wrote:
Thanks you so much for your input. I think I need to add a little
more to my disruptions. First here is the code that I'm using

Private Sub CommonName_AfterUpdate()
Forms!frm_AddEdit_Equipment_Master.lst_EquipID.Req uery
End Sub


Action: When I update this field and move to another field the screen
will flicker like it is refreshing but nothing happens... If I go
back to the field and change it again and leave then the list box will
update but it displays the first change and not the last change.


I'm guessing that I need to update the record (save the record) before
I update the list box. I have search help but not able to find the
command to post the changes to the table before I refresh.


That would appear to be correct if the listbox's rowsource are records
in a table and not a value list or user defined list. If you haven't
committed the changes (saved record) and the rowsource is from a table,
it certainly is not going to have that in the listbox.

You could enter a command like
Me.Dirty = False
to save the record just prior to requerying. Another option is to put
the Requery in the AfterUpdate event of the form...IOW, after the record
has been saved. I don't know why it needs to be in the listbox
immediately after a field is changed.

If you absolutely, positively need to have this when the field changes
and not when the record changes you have a couple of options....make the
rowsource a value list and concatenate the data to display. There is a
caveat using this method...I think the string length for a value list is
2048 so you can't display too many rows. Or, write a UserDefine
function. If you are willing to futz with that (maybe do some searches
at Google groups, *Access*, for userdefine callbacks, you should get
plenty of code to assist.


Can you help me?

Thanks again!

N. Graves

On Thu, 20 May 2004 21:02:27 GMT, Salad <oi*@vinegar.com> wrote:

N. Graves wrote:
Hello... thank you for your time.

I have a form that has a List box of equipotent records and a sub form
that will show the data of the equipment select from the list box.

Is it possible to make a change in the name field in the details, then
refresh the list box with new name?

Please help and thanks!

N. Graves

If refreshing in the main form, and the listbox is called LB1, then
Me.LB1.Requery
If the LB is in a main form but called to refresh from a subform
Forms!MainForm!LB1.Requery



Nov 13 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.