Dear all,
I have started working with vba only three weeks ago so forgive me for any basic mistakes. I have a small problem, I am creating a database for work and I am stuck
I have made a search function to look up my User in "Tbl_Users" . The form opens with a subquery showing the found records. So far so good.
What I am trying to implement is a 'Delete' Button, to delete the record selected in the SubQuery by the press of that button. This is the applicable part of my code so far:
This should usually work, the problem is however that the table is open through the subquery on my form.
Is there a way to temporarily close the table without losing my 'gvSelectedUser ' (=Global Variable), or is there perhaps another way to do this?
Thanks!
I have started working with vba only three weeks ago so forgive me for any basic mistakes. I have a small problem, I am creating a database for work and I am stuck
I have made a search function to look up my User in "Tbl_Users" . The form opens with a subquery showing the found records. So far so good.
What I am trying to implement is a 'Delete' Button, to delete the record selected in the SubQuery by the press of that button. This is the applicable part of my code so far:
Code:
Set rstdeleteuser = CurrentDb.OpenRecordset("Tbl_Users")
With rstdeleteuser
!UserID = gvSelectedUser
.Delete
End With
rstdeleteuser.Close
Set rstdeleteuser = Nothing
Is there a way to temporarily close the table without losing my 'gvSelectedUser ' (=Global Variable), or is there perhaps another way to do this?
Thanks!
Comment