frm_Item_entry is unbound and has its fields set via a defined recordset (rs). When the form opens, it has to know which record to display, so I used the openargs to pass the value from frm_search to frm_Item_entry so that the rs.findfirst could be used.
Also I changed the name of listbox from listbox to lstSearch. I think listbox is a reserved word.
In frm_Search:
Code:
Dim Response As Integer
Response = MsgBox("details" & vbCrLf & _
"----" & vbCrLf & _
"ID:- " & varID_PK & vbCrLf & _
"Item:- " & varItemname & vbCrLf & _
"Category " & varCategory & vbCrLf & _
"Type:-" & varType & " " & vbCrLf & vbCrLf & _
"Belongs To:-" & varBelongsto & " " & vbCrLf & vbCrLf & _
"For more information,Click OK", vbOKCancel, "Detailed information of item")
If Response = vbOK Then
Debug.Print lstSearch.Column(0)
DoCmd.OpenForm "frm_item_entry", , , , , , lstSearch.Column(0)
Else
In form frm_Item_entry:
Code:
Private Sub Form_Load()
Set db = CurrentDb
Set rs = db.OpenRecordset("tbl_item", dbOpenDynaset, dbSeeChanges)
rs.FindFirst "itemID_PK = " & Me.OpenArgs
refreshdata
Me.txtitemid.Visible = True
Me.lblitemid.Visible = True
End Sub