Record still not updated until close the form or run a report

S

Song

I have a cmdStart button in frmWorkshop. When click, it opens another form
frmSignIn
On load event of frmSignIn, I make frmWorkshop visible = false
Below is cmdSignIn on form frmSignIn. It seems the line
Forms!frmWorkshop.[WS]=1 always in the memory instead of update the record.
Me.Dirty=False does not help. I have to either close frmWorkshop, or run
other report be fore the update to show up. Where did I do wrong?

Private Sub cmdSignIn_Click()

Dim rst As DAO.Recordset

Set rst = Forms!frmWorkshop.RecordsetClone
If Me.intEN <> "" Then
rst.FindFirst "EN = " & Me.intEN
If rst.NoMatch Then
txtMsg = "Employee number not found!"
Else
Forms!frmWorkshop.Bookmark = rst.Bookmark
If Forms!frmWorkshop.[WS] = 1 Then
txtMsg = "You have already signed in " &
Forms!frmWorkshop.[Full_Name] & "!"
Else
Forms!frmWorkshop.[WS] = 1
Me.Dirty = False
txtMsg = "Welcome! " & Forms!frmWorkshop.[Full_Name] & "."
End If
Me.intEN = ""
cboLookUp = ""
End If
End If
intEN.SetFocus
rst.Close
End Sub
 
A

Arvin Meyer [MVP]

I'd bet if you looked in the table after you ran Me.Dirty = False, you'd see
the record. What you also need to do is to requery the other form so that it
refreshes the data it is using.
 
S

Song

requery solved it. thanks a lot.

Arvin Meyer said:
I'd bet if you looked in the table after you ran Me.Dirty = False, you'd see
the record. What you also need to do is to requery the other form so that it
refreshes the data it is using.
--
Arvin Meyer, MCP, MVP
http://www.datastrat.com
http://www.mvps.org/access
http://www.accessmvp.com

Song said:
I have a cmdStart button in frmWorkshop. When click, it opens another form
frmSignIn
On load event of frmSignIn, I make frmWorkshop visible = false
Below is cmdSignIn on form frmSignIn. It seems the line
Forms!frmWorkshop.[WS]=1 always in the memory instead of update the
record.
Me.Dirty=False does not help. I have to either close frmWorkshop, or run
other report be fore the update to show up. Where did I do wrong?

Private Sub cmdSignIn_Click()

Dim rst As DAO.Recordset

Set rst = Forms!frmWorkshop.RecordsetClone
If Me.intEN <> "" Then
rst.FindFirst "EN = " & Me.intEN
If rst.NoMatch Then
txtMsg = "Employee number not found!"
Else
Forms!frmWorkshop.Bookmark = rst.Bookmark
If Forms!frmWorkshop.[WS] = 1 Then
txtMsg = "You have already signed in " &
Forms!frmWorkshop.[Full_Name] & "!"
Else
Forms!frmWorkshop.[WS] = 1
Me.Dirty = False
txtMsg = "Welcome! " & Forms!frmWorkshop.[Full_Name] & "."
End If
Me.intEN = ""
cboLookUp = ""
End If
End If
intEN.SetFocus
rst.Close
End Sub
 

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