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

updating with a combo box

Status
Not open for further replies.

smack317

IS-IT--Management
Apr 30, 2003
13
US
well my problem is that i can get the combo box to populate the form but i cannot figure out how to get the fields to update if any information is changed alos if the info in the combo box is ClientId how are they supposed to add the new Id if its locked in the box...heres my code for populating:

Private Sub Combo59_AfterUpdate()
' Get a reference to the Access Application object.
Dim cnnDB As ADODB.Connection
' Get connection to current database.
Set cnnDB = CurrentProject.Connection
Dim rst As Recordset
Set rst = New ADODB.Recordset
rst.Open "select * from ATCRF_Main where Client_Number=" & Me![Combo59], cnnDB, 3, 3

Me!Group_Num = rst("Group_Num")
Me!Initial = rst("Initial")
Me!Final = rst("Final")
Me!Resource_ID = rst("Resource_ID")
Me!Coaching_Sessions = rst("Coaching_Sessions")
Me!Accessing_Resources = rst("Accessing_Resources")
Me!Adult_Issues = rst("Adult_Issues")
Me!Basic_Letter_Writing = rst("Basic_Letter_Writing")
Me!Case_Man = rst("Case_Man")
Me!IEP_Checklist = rst("IEP_Checklist")
Me!Indep_Living = rst("Indep_Living")
Me!IRP = rst("IRP")
Me!Life_Planning = rst("Life_Planning")
Me!PBS = rst("PBS")
Me!TTL = rst("TTL")
Me!Web_Sites = rst("Web_Sites")
Me!R_Title = rst("R_Title")
Me!In_Use = rst("In_Use")
Me!In_Process = rst("In_Process")
Me!Not_Using = rst("Not_Using")
Me!Company_Name = rst("Company_Name")
Me!Address = rst("Address")
Me!City = rst("City")
Me!State = rst("State")
Me!Zip = rst("Zip")
Me!Country = rst("Country")
Me!Phone = rst("Phone")
Me!Case_QMRP = rst("Case_QMRP")
End Sub


thanks ahead of time
 
smack317, if you are a very experienced Access developer, please disregard!

If not, it seems that you might get more of what you want by "binding" the controls like Me!Group_Num to the recordset (by setting their ControlSource property to the name of the appropriate field in the Design View Properties window.) Then changes to the data that the user makes in the control will also be made to the field in the recordset.

Your combobox can then just update the "RecordSource" of the form, and all the controls will update because they are bound to the field in the recordset. The simplest way to add new would be to leave the navigation buttons on the form enabled, so that users can just click the star to make a new record.

Ron

 
thats been done already thanks though
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top