Unanswered: Newbie need help: put search result of one form to another one using openargs
I'm new to Access VBA and now I'm learning access VBA using "Microsoft access VBA for dummies" book. When I'm learning about the basic of openargs, I have the following problem:
As guided in the book, in the customers form, I put the following code on the lastname control's click event:
Private Sub LastName_Click()
Dim rs As New Recordset
Dim frm As DAO.Recordset
locate = InputBox("please input your lastname here:", "HAL VIETNAM")
" select customerid from customers where " & _
" lastname like '" & locate & "%'", _
CurrentProject.Connection, adOpenKeyset, adLockOptimistic
If rs.EOF Then
MsgBox " nothing found"
If rs.RecordCount > 1 Then
OpenArgs:=" lastname like '" & locate & "*'"
Set frm = Me.RecordsetClone
frm.FindFirst " lastname like '" & locate & "*'"
Me.Bookmark = frm.Bookmark
In the "seachform" form's load event, I put the following code:
Private Sub Form_Load()
.RowSource = "select customerid, " & _
"lastname & ', ' & firstname as Name, " & _
" from customers where " & Me.OpenArgs
.ColumnCount = 3
.ColumnHeads = True
.ColumnWidths = "0;1.5 in;1.5 in"
But it don't work.
Could anyone tell me something is wrong and correct it for me?
I attached the axample file on this post.