Hi I have a form with various text boxes/combo boxes check boxes representing the fields in a table, on save I want to add the record to the table thus using dmax +1 for the autonumber ensuring no issues with multiple users getting the same number. the following wont work.
Second question is do I need to do a character check on each field to ensure the user has not entered too many characters?
Thanks
Private Sub Command66_Click()
Dim dbNCW6b As DAO.Database
Dim rsttblInvestigations As DAO.Recordset
Set dbNCW6b = CurrentDb
Set rsttbInvestigations = dbNCW6b.OpenRecordset("tblInvestigations")
rsttblInvestigations.AddNew
rsttblInvestigations("No").Value = Me.No
rsttblInvestigations("Due Date").Value = Me.Due_Date
rsttblInvestigations("Notes").Value = Me.Notes
rsttblInvestigations("Date Logged").Value = Me.Date_Logged
rsttblInvestigations("Source").Value = Me.Source
rsttblInvestigations("Investigator").Value = Me.Investigator
rsttblInvestigations("Section").Value = Me!Section
rsttblInvestigations("Method").Value = Me.Method
rsttblInvestigations("Ref1").Value = Me.Ref1
rsttblInvestigations("Ref2").Value = Me.Ref2
rsttblInvestigations("Evidence Only").Value = Me.Evidence_Only
rsttblInvestigations("Issue").Value = Me.Issue
rstrsttblInvestigations.Update
End Sub
Second question is do I need to do a character check on each field to ensure the user has not entered too many characters?
Thanks
Private Sub Command66_Click()
Dim dbNCW6b As DAO.Database
Dim rsttblInvestigations As DAO.Recordset
Set dbNCW6b = CurrentDb
Set rsttbInvestigations = dbNCW6b.OpenRecordset("tblInvestigations")
rsttblInvestigations.AddNew
rsttblInvestigations("No").Value = Me.No
rsttblInvestigations("Due Date").Value = Me.Due_Date
rsttblInvestigations("Notes").Value = Me.Notes
rsttblInvestigations("Date Logged").Value = Me.Date_Logged
rsttblInvestigations("Source").Value = Me.Source
rsttblInvestigations("Investigator").Value = Me.Investigator
rsttblInvestigations("Section").Value = Me!Section
rsttblInvestigations("Method").Value = Me.Method
rsttblInvestigations("Ref1").Value = Me.Ref1
rsttblInvestigations("Ref2").Value = Me.Ref2
rsttblInvestigations("Evidence Only").Value = Me.Evidence_Only
rsttblInvestigations("Issue").Value = Me.Issue
rstrsttblInvestigations.Update
End Sub