![]() | |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
We have a VisualBasic application for our field personnel that stores data in an MS-Access database. When they come out of the field their individual databases are read and added to the master database. We are no longer using Autonumber since it started generating existing keys. The lead table in the master database has a primary key of type Number. When adding a new record I use the AddNew method. I obtain the current time and convert it to a double. Then I set the primary key id to this value. But it doesn't stick. My MsgBox shows it as 0. Dim sPK As String Dim dPK As Double sPK = Format(Date(), "yyyymmdd") & Format(Time(), "hhnnss") dPK = CDbl(sPK) . . . rsM0.AddNew rsM0!pkg_id = dPK . . . rsM0.Update MsgBox("pkg_id=" & rsM0!pkg_id) Would someone please show me how to set the primary key without using AutoNumber. |
![]() |
| Thread Tools | |
| Display Modes | |
| |