I have an unbound control "CC_Security_1_ TextBox" that gets its data from a crosstab query tied to the form. What i need is code that would update the table "CC Security" which has two columns: User and CC Security Rule when someone changes the data on the form.
I'm using an AfterUpdate event that i haven't completed, but can't find a related topic on bytes to help me finish it, so i thought i'd ask.
I think i need the code to remember the original value so it can find and delete it because what i have so far uses the new value to find and delete, which doesn't exist. The insert part seems to be working and the requery part works as well.
Any help would be greatly appreciated.
Thanks,
Omar
I'm using an AfterUpdate event that i haven't completed, but can't find a related topic on bytes to help me finish it, so i thought i'd ask.
I think i need the code to remember the original value so it can find and delete it because what i have so far uses the new value to find and delete, which doesn't exist. The insert part seems to be working and the requery part works as well.
Code:
Private Sub CC_Security_1_TextBox_AfterUpdate() If Me.CC_Security_1_TextBox = "" Then CurrentDb.Execute " DELETE * FROM [CC Security] WHERE User = '" & Me.User_ID & "' AND [CC Security] = '" & Me.CC_Security_1_TextBox & "';" Else CurrentDb.Execute " INSERT INTO [CC Security] ( [User], [CC Security Rule] ) VALUES ('" & Me.User_ID & "', '" & Me.CC_Security_1_TextBox & "');" End If Dim holdID As String holdID = Me.User_ID.Value Me.Requery Set rs = Me.RecordsetClone rs.FindFirst "[User ID] ='" & holdID & "'" Me.Bookmark = rs.Bookmark End Sub
Thanks,
Omar
Comment