F
Fuzzy Logic
I have created a form that accesses a very simple table called tabletest
with two fields:
Index Comment
1 One
2 Two
3 Three
4 Four
etc...
I have created a form that displays one record from the form and has a
button on it. What I want to have happen when I have record 2 displayed and
hit the delete button is to get the following results:
Index Comment
1 One
2 Three
3 Four
etc.
preferably with the 'new' record 2 displayed.
My VBA/Access skills are currently very limited. Here is the code I have
from the button>Build Event for my form:
Private Sub Delete_Click()
Dim tempindex As Integer
tempindex = temp.index
DoCmd.RunSQL "DELETE * FROM tabletest WHERE tabletest.index=[tempindex]"
DoCmd.RunSQL "UPDATE tabletest SET tabletest.index = tabletest.index-1
WHERE tabletest.index > [tempindex]"
Exit Sub
End Sub
This is obviously not working. Can anyone fix the syntax of this to make it
work? Any pointers would be GREATLY appreciated as I am getting quite
frustrated with this. TIA
with two fields:
Index Comment
1 One
2 Two
3 Three
4 Four
etc...
I have created a form that displays one record from the form and has a
button on it. What I want to have happen when I have record 2 displayed and
hit the delete button is to get the following results:
Index Comment
1 One
2 Three
3 Four
etc.
preferably with the 'new' record 2 displayed.
My VBA/Access skills are currently very limited. Here is the code I have
from the button>Build Event for my form:
Private Sub Delete_Click()
Dim tempindex As Integer
tempindex = temp.index
DoCmd.RunSQL "DELETE * FROM tabletest WHERE tabletest.index=[tempindex]"
DoCmd.RunSQL "UPDATE tabletest SET tabletest.index = tabletest.index-1
WHERE tabletest.index > [tempindex]"
Exit Sub
End Sub
This is obviously not working. Can anyone fix the syntax of this to make it
work? Any pointers would be GREATLY appreciated as I am getting quite
frustrated with this. TIA