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!
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!