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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

List box overwriting data 1

Status
Not open for further replies.

vba317

Programmer
Mar 5, 2009
708
US
I have created a form that has a listbox on it. It is linked to one table called tblClient. The listbox contains clients initials. I click on the initials and a click event gets executed. For some reason the clients initials get copied to the client below and now that client exists twice in the table (tblClient) and the other client is missing. What can I do to prevent this from happening? None of the queries within the Process steps do anything with the table in question.

Tom

Code:
Private Sub txtUCI_Click()
    Dim strUCI As String
    strUCI = txtUCI.Value
    With DoCmd
        'Run all the Delete Queries
        Call ProcessStep1
        Call ProcessStep2
        Call ProcessStep3(strUCI)
        Call ProcessStep4
    End With
End Sub
 
Your listbox is bound to the table. It should be unbound.
 
I removed the record source to unbind the form from the table. Now whenever I click on the client's initials I get an error at the bottom of the form. Control can't be edited it's bound to unbound field UCI. Is there a work around fot this?
 
Your Form should likely be bound, but the listbox should not. The listbox is not being used to populate the field, it is being used for controlling query execution.

The listbox should have a Rowsource which controls what are the choices in the list. It should not have a controlsource, which is the field that gets populated when you choose something in a list.
 
Actually, I am not sure if your form should be bound or not since there is not enough information to determine that. But in either case the control source of the listbox should be blank.
 
When I thought I deleted the record source, I didn't. I went back in I cleared out everything and now it works great thanks Majp!

Tom
 
To All . . .

The attack on the easy ones is amazing! ... Just notice the response time! ... It saids it all ...

See Ya . . .

Be sure to see FAQ219-2884 Worthy Reading! [thumbsup2]
Also FAQ181-2886 Worthy Reading! [thumbsup2]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top