Converting Access 97 module to 2000

  • Thread starter Thread starter pangloss
  • Start date Start date
P

pangloss

Guest
I am old enough to find vB coding and its ever changing syntax difficult to keep up with!

This particular database contains a table of dates and, most of the time, they repeat weekly or two-weekly. I had a module which would do this when CTRL+# or CTRL+] was pressed.

On converting it to Access 2000 the module adds extra records but fails to enter any dates. If someone could help me with the conversion I should be very grateful (of course!).

This is the module:

_________________________________________________

Private Sub Form_KeyPress(KeyAscii As Integer)
Dim intI As Integer
Dim rs As Recordset
If KeyAscii = 28 Then
Set rs = Me.RecordsetClone
Reference = [Group ref]
For intI = 1 To 12
rs.AddNew
rs!Date = [Date] + (7 * intI)
rs![Group ref] = Reference
rs.Update
Next intI
rs.Close
ElseIf KeyAscii = 29 Then
Set rs = Me.RecordsetClone
Reference = [Group ref]
For intI = 1 To 8
rs.AddNew
rs!Date = [Date] + (14 * intI)
rs![Group ref] = Reference
rs.Update
Next intI
rs.Close
End If

End Sub


________________________________________________


Hope someone can help. The graphic means I hope to see the light!
 
Instead of changing my syntax, I've just changed the library references when I've converted to 2000. Try going to the references and check the DAO library.
 
Many thanks for the hint. I see that DAO Library 3.6 object library is checked. The other DAO libraries seem to have lower numbers so I think the latest one is activated.

Hence the problem does not appear to be beaten yet!!
 
In A2K I believe you need to explicitly declare rs as a DAO library object or it is assumed to be ADO

Dim rs as DAO.Recordset
 
Still no luck! I am away for a few days so will not be able to try anything just yet.
 

Users who are viewing this thread

Back
Top Bottom