thisisntwally
CE&A
- Local time
- Today, 17:28
- Joined
- Jun 27, 2007
- Messages
- 246
according to wayne
This was exactly what I was looking for. So i did it like so:
Lo it grabs a PK value from the table, but the value has been randomly selected from the middle records. Each time I try it, the record increases by one. Additionally, it seems that this number is being used to make the new record, which is then rejected as it would create a duplicate PK value.
Whats going on here? Maybe this is no longer supported?
Stuart,
WayneCode:With rs .Open "Contracting Agency List", cn, adOpenStatic, adLockPessimistic 'open it .AddNew .Fields("Vendor") = CompanyName ' ' Right here .Fields("YourAutoNumberField") has the proper value ' after the .Update, its value will be wrong. ' .Update 'update the table .Close 'close the recordset connection End With
This was exactly what I was looking for. So i did it like so:
Code:
Dim db As DAO.Database
Dim tblSubProj As DAO.Recordset
Set db = CurrentDb
Set tblSubProj = db.OpenRecordset("tblSubProj", dbOpenDynaset)
With tblSubProj
.AddNew
!Date = Now
!ABRID = Forms!frmMaster!frmBNR!txtABRID
!ProjectTitle = Me.txtPT
Me.txtSPID = !SPID 'this is where I grab the PK except...
.Update
Whats going on here? Maybe this is no longer supported?