Home > Microsoft Access Help > Combo Box Populates All Form Records

Combo Box Populates All Form Records



Hi everyone,



I have a form with a combo box, whose afterupdate code is:



Private Sub CustomerName_AfterUpdate()



Dim rs As Recordset

Dim person As String

{This will contain the SQL Statement}

person = "select people.department from people where people.name='" & CustomerName.Value & "'"

Set rs = CurrentDb.OpenRecordset(person)

{Now the following are combo/text boxes that are populated}

Department.Value = rs("department")

InputDate = Date

InputTime = Time



My code works: when you select something in CustomerName combo box, the other boxes in the record get populated with data. The problem is that ALL the records in the form get populated with this data as well...

I want the records to be independent of each other - that each record will be filled separately.



Any ideas?



Thanks,



Gilad.

    
Guest


is your form a continuous form? If so, this behaviour is unavoidable. Change your form to Single view.

Was this answer helpful ? Yes No   
Guest
 
 
Home - About Infoqu - Contact - Privacy Statement - Link to Infoqu - Bookmark Infoqu

Copyright 2007-2008 by Infoqu. All rights reserved