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!

Auto Fill Records 1

Status
Not open for further replies.

dscoiho

MIS
Sep 26, 2005
51
US
Ok not sure on how to approach this due to still learning basics. I am using a Access to setup a daily work completed database. I have form that would list daily work that could be checked if it was done. What I am looking for is when these are checked and click on button to either close or update, it would automatically add this work into table for today for each checkbox.
 
Need to understand first how you tables are set up. Please post. The design you are referring to will probably require code. A design that does not require code would be a main form with a person and date with a subform of jobs completed for that day. In the subform you could pull from a list of available jobs to make a record. Again, you will probably need to supply table info and relationships. Something like:

tblName
fldName (primary key)
fldName2
...
 
You can play with the following code and put it on a command button's On Click or on the form's OnClose or whatever you want:

Private Sub Command0_OnClick()
Dim DB As DAO.Database
Dim RS As DAO.Recordset
Dim strWhere As String
Set DB = CurrentDb()
Set RS = DB.OpenRecordset("YourTableName", dbOpenDynaset)
'strWhere = "[TablePrimKey] = " & Me![FormFielName]
'RS.FindFirst strWhere
'If RS.NoMatch Then
' 'MsgBox "No match found"
'Else
RS.AddNew
RS![TableField] = Me![FormControlboxName]
RS![NextTableField] = Me![AnotherFormControlName]
ETC.
RS.Update
'End If
RS.Close
DB.Close
Set RS = Nothing
Set DB = Nothing
End Sub

Commented lines are there if you need them.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top