M
Mac@440th
I am a Access and Visual Basic novice and, as such, need some
assistance. What I assumed would be an easy task is proving to be a
headache for me.
Problem: Obtain a MAX(xx) record from the database based on user input
to a field (Me.WorkGpID), then display that record in another field
(str_ActionItem) on the same form. Here is the code I am currently
using:
Private Sub WorkGpID_LostFocus()
Dim dbs As Database
Dim rs As Recordset
Dim seldata As String
seldata = "SELECT MAX(W.ActionItemNr) FROM tbl_Worksheet W WHERE
W.WorkGpID = '" & Me.WorkGpID & "';"
' MsgBox (seldata)
Set dbs = CurrentDb.OpenRecordset(seldata)
' >>> Here is where I would like the results of my query to be
placed '
[str_ActionItem] = ???
rs.Close
dbs.Close
End Sub
If anyone can point me in the right direction, it would be greatly
appreciated!!
Thanks in advance for all your assistance.
assistance. What I assumed would be an easy task is proving to be a
headache for me.
Problem: Obtain a MAX(xx) record from the database based on user input
to a field (Me.WorkGpID), then display that record in another field
(str_ActionItem) on the same form. Here is the code I am currently
using:
Private Sub WorkGpID_LostFocus()
Dim dbs As Database
Dim rs As Recordset
Dim seldata As String
seldata = "SELECT MAX(W.ActionItemNr) FROM tbl_Worksheet W WHERE
W.WorkGpID = '" & Me.WorkGpID & "';"
' MsgBox (seldata)
Set dbs = CurrentDb.OpenRecordset(seldata)
' >>> Here is where I would like the results of my query to be
placed '
[str_ActionItem] = ???
rs.Close
dbs.Close
End Sub
If anyone can point me in the right direction, it would be greatly
appreciated!!
Thanks in advance for all your assistance.