A
Angi
This code works great, acts just like an option group for cts forms.
Except one small problem...it updates all the records in the table
instead of the ones just for the current CoID. I've tried adding a
Where statement but then it says I have too few parameters. Expected
1. What am I supposed to do here?
TIA!
Private Sub Default_BeforeUpdate(Cancel As Integer)
Dim sql As String
sql = "SELECT ShipToMain.*, ShipToMain.CoID FROM ShipToMain WHERE
(((ShipToMain.CoID)=me.CoID)AND ((ShipToMain.Default)=Yes));"
If Me.Default = True And Not IsNull(sql) Then
CurrentDb.Execute "Update shiptomain Set shiptomain.default =
no;", dbFailOnError
End If
End Sub
Except one small problem...it updates all the records in the table
instead of the ones just for the current CoID. I've tried adding a
Where statement but then it says I have too few parameters. Expected
1. What am I supposed to do here?
TIA!
Private Sub Default_BeforeUpdate(Cancel As Integer)
Dim sql As String
sql = "SELECT ShipToMain.*, ShipToMain.CoID FROM ShipToMain WHERE
(((ShipToMain.CoID)=me.CoID)AND ((ShipToMain.Default)=Yes));"
If Me.Default = True And Not IsNull(sql) Then
CurrentDb.Execute "Update shiptomain Set shiptomain.default =
no;", dbFailOnError
End If
End Sub