Question : Making a form editable in Access 2002

I have a form in Access that I would like to make editable, please see the document enclosed.

Help would be much appreciated

Stewart

Answer : Making a form editable in Access 2002

I'm not sure how your form is built, but from the document, it looks like this is an unbound form (i.e. the Form has no Recordsource, and the Controls have no ControlSource). If this is true, then the simplest way to handle this is to "bind" the form to a table, unless you have a good reason not to do so.

Is the data in the form based on records from the same table? It looks like everything is coming from a table named "tblComuterSpec". If so, then set the Recordsouce of your form to this:

SELECT * FROM tblComputerSpec

and then set EACH control's ControlSource to the relevant field in that table. For example, the FullN field's ControlSource would be "FullName", the Cntry field's ControlSource would be "Country", and so on.

To filter those records on the UserName field, you could do this, perhaps in the Form's Load event:

Me.Filter = "UserName='" & Me.UserN & "'"
Me.FilterOn = True

From there, you could immediately Edit records; to add a new record, use this code:

'/first force a save
Me.Dirty = False
DoCmd.RunCommand acCmdRecordsGoToNew

To delete the current record:

Me.Dirty = False
DoCmd.RunCommand acCmdDeleteRecord


Random Solutions  
 
programming4us programming4us