show current record

Good Grief!!!!

I spent a bunch of time copying tables, removing "sensitive" info, putting in bogus info so I could post the DB and now it seems to be working. Don't know why, do I have to close it and re-open it for changes to take effect? can't be. anyway it works but.........

When It opens the EditBom3 form it goes to the record I want but it is now stuck on that record and can't be changed to another unless I close that form and re-open it. Is there some code so I will be able to search another number without closing the form.
 
Ok, so remembering I'm a novice and this is actually my 1st DB

Dim rs As Object ---- Whats rs? a record set?
Dim lngBookmark As Long --- lngBookmark is just a variable name? Mine will be Dim StringBookmark as String?

'set a variable to the current record
lngBookmark = Me.txtEmpID ----- mine will be StringBookmark=Me.Product_Number

'open the new form
DoCmd.OpenForm "frmEmployeesDetail" ----- mine DoCmd.OpenForm "EditBom3"

'take it to the selected record
Set rs = Forms!frmEmployeesDetail.RecordsetClone ------ mine Set rs =
Forms!EditBom3.RecordsetClone

rs.FindFirst "EmpID = " & lngBookmark ------ mine rs.FindFirst "Product_Number =" & StringBookmark

Forms!frmEmployeesDetail.Bookmark = rs.Bookmark ----- mine Forms! EditBom3.Bookmark (not StringBookmark?)

Set rs = Nothing


hope this makes sese
 
Looks close, presuming your value is text. This would change to:

rs.FindFirst "Product_Number ='" & StringBookmark & "'"
 
I guess I messed up somewhere. Here is the code i put in.



Private Sub Command75_Click()
'DoCmd.OpenForm "EditBom3", , , "[Product Number] = '" & Me.Product_Number & "'"
Dim rs As Object
Dim StringBookmark As String

'set variable to current record
StringBookmark = Me.Product_Number

'open new form
DoCmd.OpenForm "EditBom3"

'take it to selected record
Set rs = Forms!EditBom3.RecordsetClone

rs.FindFirst "Product_Number ='" & StringBookmark & "'"
Forms!EditBom3.StringBookmark = rs.StringBookmark

Set rs = Nothing
 
sorry, the error is unknown or invalid field reference Product_Number
 
I've seen you use both a space and an underscore in the name. Make sure of which it is, and if it's an inadvisable space the name will have to be bracketed.
 
Sorry for the long delay with this but I got pulled off onto another project and am just getting back to this. I fixed the bracketing problem

Dim rs As Object
Dim StringBookmark As String

'set variable to current record
StringBookmark = Me.Product_Number

'open new form
DoCmd.OpenForm "EditBom3"

'take it to selected record
Set rs = Forms!EditBom3.RecordsetClone

rs.FindFirst "[Product Number] ='" & StringBookmark & "'"
Forms!EditBom3.StringBookmark = rs.StringBookmark

now the error goes to the last line and says
Object does not support this property or method.:(
 
Try

Forms!EditBom3.Bookmark = rs.Bookmark
 
:DThank you pbaldy that worked. I looked up bookmark property and understand it a little better but don't think i get it fully.

Thanks again for all your help.
 
Glad we got it sorted out.
 

Users who are viewing this thread

Back
Top Bottom