Running an UPDATE query in code to update a subform that reflects anunderlying Table

  • Thread starter nouveauricheinvestments
  • Start date
N

nouveauricheinvestments

Hi,

I'm have a subform that displays records in a table. In this table,
there is a boolean field called 'SelectTicket'. I have attached the
following code to the subform that should only allow the user to ever
select one record as being true. It doesn't work though. Any ideas
what I am doing wrong? I'm not very good with access coding yet.

Thanks

Private Sub SelectTicket_Click()
Dim strSQL As String
Dim lngKey As String


lngKey = Me!Explanation.Text
strSQL = "UPDATE OpenTicketsSubForm SET SelectTicket=FALSE"
CurrentDb.Execute strSQL, dbFailOnError
Me.Requery
With Me.RecordsetClone
Me.Explanation.SetFocus
.FindFirst Explanation.Text = lngKey
If Not .NoMatch Then
Me.Bookmark = .Bookmark
Me.SelectTicket = True
End If
End With
DoCmd.Close acForm, "ViewSelectedOpenTicket"

Me!SelectTicket.SetFocus
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top