help on syntax for update query

G

GitarJake

Hello All,

I have a Song selection app that when you press a "Key" button, the current
song gets listed in a sub-form and a "Song Order" gets incremented by 1.
Now I want to press a button and have the Song Order re-order to fix the
gaps in the order when I delete selections from the list. Below is the code
I use to select if it helps. What is the syntax for an update query to
accomplish this?

TIA,

Jake

Private Sub KeyBb_Btn_Click()
On Error GoTo Err_KeyBb_Btn_Click

If Me!SongSelect.Value = True Then
MsgBox Me.SongTitle & " has already been selected", , "Repeated
Selection"
GoTo Exit_KeyBb_Btn_Click
Else
Me!SongSelect.Value = True
Me!KeyBb_Chk.Value = True

If Me!LyricList!SongOrder.Value = Null Then
SongOrder.Value = 1
Else
SongOrder = Nz(DMax("[SongOrder]", "[Songs]", acForm)) + 1
End If
End If

DoCmd.RunCommand acCmdRefresh

Exit_KeyBb_Btn_Click:
Exit Sub

Err_KeyBb_Btn_Click:
MsgBox Err.Description
Resume Exit_KeyBb_Btn_Click

End Sub
 
Top