Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

update textbox 1

Status
Not open for further replies.

Duane8889

Programmer
Dec 14, 2001
46
0
0
US
Hello
I need to update a textbox that shows the number of items in a listbox. I tried using this code but I suspect that asCmdSave Record isn't right
Code:
Private Sub lstEmployees_AfterUpdate()
    DoCmd.RunCommand acCmdSaveRecord
    DoEvents
    txtCount.Requery
End Sub

It doesn't do anything to change the textbox, txtCount.

I input names into a textbox that is saved to a table that the listbox shows the records.
The code for the textbox to table is...
Code:
Private Sub cmdAddEmployee_Click()
On Error GoTo Err_cmdAddEmployee_Click

    txtAddEmployee.SetFocus
    DoCmd.GoToRecord , , acNewRec
        
Exit_cmdAddEmployee_Click:
    Exit Sub

Err_cmdAddEmployee_Click:
    MsgBox Err.Description
    Resume Exit_cmdAddEmployee_Click
    
End Sub

any ideas?

Duane
 
What is the ControlSource property of txtCount ?

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
thanks PHV. There is no ControlSource, it's unbound. I use this to fill the box...
Code:
Private Sub Form_Load()
    Dim myString As String
    txtCount = lstEmployees.ListCount & " employees"
End Sub

 
So, replace this:
txtCount.Requery
By this:
txtCount = lstEmployees.ListCount & " employees"

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Thanks again PHV!
as always your posts are spot on!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top