C
Chhunhour
1).I have a problem with AutoNumber on my database with ID
field, example if I have ID like: E001,E002,E003,E004,E005
then if I delete a record with ID E003 then the data store
in my table will become as follow: E001,E002,E004,E005 and
when a form loard AutoNumber will start ID from E006 so
how should I do to make it start among the missing ID,E003?
Below is my coding of AutoNumber:
Function AutoID() As String
Dim id%
Dim rst As DAO.Recordset
Set rst = CurrentDb.OpenRecordset("select ID from
tblemployee order by ID")
If rst.RecordCount > 0 Then
rst.MoveLast
id = Right(rst(0), Len(rst(0)) - 1)
id = id + 1
AutoID = "E" & Format(id, "000")
Else
AutoID = "E001"
End If
rst.Close
End Function
Please help correct the above code to my requirement as
possible.
2).Please help show code printing a document or report on
any kind of printer?
Thanks,
Chhunhour.
field, example if I have ID like: E001,E002,E003,E004,E005
then if I delete a record with ID E003 then the data store
in my table will become as follow: E001,E002,E004,E005 and
when a form loard AutoNumber will start ID from E006 so
how should I do to make it start among the missing ID,E003?
Below is my coding of AutoNumber:
Function AutoID() As String
Dim id%
Dim rst As DAO.Recordset
Set rst = CurrentDb.OpenRecordset("select ID from
tblemployee order by ID")
If rst.RecordCount > 0 Then
rst.MoveLast
id = Right(rst(0), Len(rst(0)) - 1)
id = id + 1
AutoID = "E" & Format(id, "000")
Else
AutoID = "E001"
End If
rst.Close
End Function
Please help correct the above code to my requirement as
possible.
2).Please help show code printing a document or report on
any kind of printer?
Thanks,
Chhunhour.