I am using a datasheet view with dbl click code to open a form to a selected record.
I was able to use pbaldy's code and it worked perfectly.
DoCmd.OpenForm "Asset Status", , , "[Project Number] = '" & Me.Project_Number & " ' "
Then I realized I really want to be able to go to other records after I have gone to this form and tried this:
Dim rs As Object
Dim lngBookmark As Long
'set variable to the current record
lngBookmark = Me.Project_Number
'open new form
DoCmd.OpenForm "Asset Status"
'take it to selected record
Set rs = Forms![Asset Status].RecordsetClone
rs.FindFirst "[Project Number] = '" & lngBookmark & " ' "
'the lines marked as optional can be included if there's a chance the record won't exist in the form being opened
' If rs.NoMatch Then 'optional - if no match, go to a new record
' DoCmd.GoToRecord acForm, "frmEmployeesDetail", acNewRec 'optional
' Forms!frmEmployeesDetail.txtEmpID = Me.txtEmpID 'optional - copy the employee ID from this form
' Else 'optional
Forms![Asset Status].Bookmark = rs.Bookmark
'End If 'optional
Set rs = Nothing
But to no avail. Project_Number is a text field.
If anyone can help me figure out where I am missing it I would appreciate it.
I was able to use pbaldy's code and it worked perfectly.
DoCmd.OpenForm "Asset Status", , , "[Project Number] = '" & Me.Project_Number & " ' "
Then I realized I really want to be able to go to other records after I have gone to this form and tried this:
Dim rs As Object
Dim lngBookmark As Long
'set variable to the current record
lngBookmark = Me.Project_Number
'open new form
DoCmd.OpenForm "Asset Status"
'take it to selected record
Set rs = Forms![Asset Status].RecordsetClone
rs.FindFirst "[Project Number] = '" & lngBookmark & " ' "
'the lines marked as optional can be included if there's a chance the record won't exist in the form being opened
' If rs.NoMatch Then 'optional - if no match, go to a new record
' DoCmd.GoToRecord acForm, "frmEmployeesDetail", acNewRec 'optional
' Forms!frmEmployeesDetail.txtEmpID = Me.txtEmpID 'optional - copy the employee ID from this form
' Else 'optional
Forms![Asset Status].Bookmark = rs.Bookmark
'End If 'optional
Set rs = Nothing
But to no avail. Project_Number is a text field.
If anyone can help me figure out where I am missing it I would appreciate it.