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!

form populated by a combo box

Status
Not open for further replies.

LOSERMANN

Instructor
Nov 9, 2002
25
0
0
US
I have a form that users can use a combo box that populates the rest of the fields on the form.....works great at retrieving the data. no complaints there. what im having trouble with is....the retrieved data cannot be edited. i change some of the retrieved information and then go back to the table the data lives in and no change has been made. im sure im missing something simple in the properties some where. any sugestions on where i might look? im hoping that ill be able to populate the form in the same fasion and make changes to the data.

thanks a bunch in advance
 
Hi

Have you tried to edit the data in the query that is the source of your form, presuming it is a query. Remember that some queries, because they rely on joins and filters, cannot be edited.

If that is not the case then perhaps the properties of your form, allowEdits, AllowAdditions are set to No.
 
Thanks so much for your quick response saltecho, i should have given more info on my troubles.

the form is based on a query and all the text boxes are populated based on the selection in a combo box named cboLastName. this workes great for retrieval of the data. i have checked the properties of the form and the "allowedits", "allowdeletions" and the "allowadditions" properties are all set to "yes". still when i change any of the retireved data the changes arent reflected in the table the original data resides.

Private Sub cboLastName_AfterUpdate()
Me.FirstName.Value = Me.cboLastName.Column(1)
Me.studentID.Value = Me.cboLastName.Column(2)
Me.Status.Value = Me.cboLastName.Column(3)
Me.ReasonForExit.Value = Me.cboLastName.Column(4)
Me.Notes.Value = Me.cboLastName.Column(5)
Me.StartDate.Value = Me.cboLastName.Column(6)
Me.ExitDate.Value = Me.cboLastName.Column(7)
End Sub

is it posible to modify this code to allow for the data to be changed and then send that info back to the table?

thanks

 
the reson for this is beacuse your form is not bound to the data hence when you edit a control your table is not updated try binding the form to the query
me.recordsource=qureyname
if this is not a option try runing the query if you can edit data in the query putting something like this in the after update of each control=ud()
and and this function to the forms modules
function ud()
docmd.runsql “UPDATE [queryname] SET [queryname].& me.activecontrol.name & "= '" & me.activecontrol & "' WHERE (((queryname.studentid)=" & me.studentid & "));"
end function
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top