using a form to update a listbox (1 Viewer)

gcrutch

Registered User.
Local time
Today, 11:05
Joined
Jan 31, 2011
Messages
51
I have a main form with a listbox and a command button for the listbox. When the use clicks the command button (called Carts) a new form opens for the user to enter information that pertains to the Cart. When the user enters the data in the new form and clicks save I need the listbox on the main form to update. The main form has 5 fields - SerialNbr, Status, Date, Event and Remarks. However the listbox only has the SerialNbr. So the only field I need from the new form to be updated in the listbox is the SerialNbr. I hope this makes sense.
 

gcrutch

Registered User.
Local time
Today, 11:05
Joined
Jan 31, 2011
Messages
51
the listbox is on the mainform. So when I use that code on the other form of the Exit event it's not recognizing the .Requery part
 

lcook1974

Registered User.
Local time
Today, 14:05
Joined
Dec 21, 2007
Messages
330
Try putting a button that will close the form with that code behind it. Not sure it it will work on the On Exit event.

Forms!Mainform!ControlName.requery
 

gcrutch

Registered User.
Local time
Today, 11:05
Joined
Jan 31, 2011
Messages
51
I'm sorry I didn't mean on the actual on Exit event. there is a command button called "Exit" that I put the code behind. but it didn't work.
 

gcrutch

Registered User.
Local time
Today, 11:05
Joined
Jan 31, 2011
Messages
51
i tried to upload the db but it say's "a security token is missing"
 

lcook1974

Registered User.
Local time
Today, 14:05
Joined
Dec 21, 2007
Messages
330
Did you put it in a zip file? There's a 'size' limit for uploads.
 

lcook1974

Registered User.
Local time
Today, 14:05
Joined
Dec 21, 2007
Messages
330
compact and repair the DB...see if that reduces the size.
 

gcrutch

Registered User.
Local time
Today, 11:05
Joined
Jan 31, 2011
Messages
51
yea I did that but unfortunately it did not decrease the size enough.
 

lcook1974

Registered User.
Local time
Today, 14:05
Joined
Dec 21, 2007
Messages
330
so the form that pops up...what do you have behind the "Close" button?

it's a completly seperate form from the one that listbox is on correct?
 

gcrutch

Registered User.
Local time
Today, 11:05
Joined
Jan 31, 2011
Messages
51
here is the code behind the close button:

DoCmd.Close acForm, "Add Cart", acSavePrompt

yes it is a separate form
 

lcook1974

Registered User.
Local time
Today, 14:05
Joined
Dec 21, 2007
Messages
330
Does that form write directly to the table?

What you need to do is requery "another" form when that form closes...

So after
Code:
DoCmd.Close acForm, "Add Cart", acSavePrompt

Add
Code:
Forms!Mainform.Form!ControlName.requery

I use this code because I'm requerying a subform and it works fine where frmQualityReview is the "MainForm" sfrmIssues is the "Subform" then I focus on the the control "cmbIssue" of the subform:
Code:
 DoCmd.Close
    Forms!frmQualityReview!sfrmIssues.Form!cmbIssueType.Requery

HTH
Larry
 

Users who are viewing this thread

Top Bottom