I gotta database and I wanna add a new record to this database. To arrange the next indexnumber for the new record I use rs.RecordCount (see code below) this is possible because the first record has indexnumber "1".So a new indexnumber for the new record will be rs.recordcount + 1 !!!
This doesn't work properly ! I get a wrong value for this recordcount. And it did work some time ago, but I changed (a lot) and I don't know what the problem can be.
It's about the second rs set and the InvestNR/IndexNR in the code below :
Set rs = Db.OpenRecordset("select InvestDate, InvestNumber From InvestmentPlanning order by IndexNumber desc;")
If Datum = rs!InvestDate Then
InvestNR = rs!InvestNumber + 1
Set rs = Db.OpenRecordset("select * From InvestmentPlanning;")
IndexNR = rs.RecordCount + 1
DoCmd.OpenForm "Newapplicationform", acNormal
Else
If Datum > rs!InvestDate Then
Set rs = Db.OpenRecordset("select * From InvestmentPlanning;")
IndexNR = rs.RecordCount + 1
InvestNR = "001"
DoCmd.OpenForm "Newapplicationform", acNormal
Else
End If
End If
This doesn't work properly ! I get a wrong value for this recordcount. And it did work some time ago, but I changed (a lot) and I don't know what the problem can be.
It's about the second rs set and the InvestNR/IndexNR in the code below :
Set rs = Db.OpenRecordset("select InvestDate, InvestNumber From InvestmentPlanning order by IndexNumber desc;")
If Datum = rs!InvestDate Then
InvestNR = rs!InvestNumber + 1
Set rs = Db.OpenRecordset("select * From InvestmentPlanning;")
IndexNR = rs.RecordCount + 1
DoCmd.OpenForm "Newapplicationform", acNormal
Else
If Datum > rs!InvestDate Then
Set rs = Db.OpenRecordset("select * From InvestmentPlanning;")
IndexNR = rs.RecordCount + 1
InvestNR = "001"
DoCmd.OpenForm "Newapplicationform", acNormal
Else
End If
End If