List Box Refresh/update

Jason1971

Registered User.
Local time
Tomorrow, 09:28
Joined
Jan 19, 2009
Messages
46
(Newbie) Hi,

Form 1: has a List Box bound to Table 1. Form 2: has a Text Box bound to Table 1. When I enter text in Text Box and click "Add" button on Form 2, I want this text to appear in the List Box in Form 1.

Code so far...

'Form 2:
Private Sub btnAdd_Project_Click()

DoCmd.Close
DoCmd.OpenForm "Front_Page_Form", acNormal

End Sub

'Form 1:
Private Sub Form_AfterUpdate()
Me.List1.Requery
End Sub

Private Sub Form_Current()
Me.List1.Requery
End Sub

Private Sub Form_GotFocus()
Me.List1.Requery
End Sub

Private Sub Form_Load()
Me.List1.Requery
End Sub

As you can see, I'm tryin' the lot (requery) but nothin's workin'. Note, the text typed in the text box does reach the table 1 ok...I have to manually hit refresh though to see any updates.
How do I get the List Box on Form 1 to update/refresh with the new text?
Thanks.
 
Even though it is a bound control and you have added it to the table it is not phyically saved until you move away from the record (this allows undo functionality).
 
So I need to include some sort of save or move-to-next-record command??...

'Form 2:
Private Sub btnAdd_Project_Click()
'save or move-to-next-record code goes here
DoCmd.Close
DoCmd.OpenForm "Front_Page_Form", acNormal

End Sub

I'm a newbie...I'm not sure what code to use?

Thanks.
 
I'm trying the following...but I'm getting a syntax error?

DoCmd.GoToRecord(acActiveDataObject ,TxtBxProject_Title,acNext,)
 
Lose ()

DoCmd.GoToRecord acActiveDataObject, TxtBxProject_Title, acNext


JR
 
DoCmd.RunCommand acCmdSaveRecord

After the value has been entered forces Access to save the record whislt the record still has the focus.
 
Solved it: The answer was to close Form 1 and reopen it...that forces a refresh of the List Box contents.

DoCmd.Close acForm, "Form 1"
DoCmd.OpenForm "Form 1", acNormal

Instead of opening and closing the form, there must be a refresh List Box command out there somewhere? Does anyone know it?
 
Nevermind this post - I didn't read the thread well enough.
 
Maybe try resetting the List1.RowSource property and then call requery.
 

Users who are viewing this thread

Back
Top Bottom