bookmark, not yet clear

deepbreath

Registered User.
Local time
Today, 11:58
Joined
Apr 18, 2001
Messages
73
i have this question before, but i am not clear about it. i have a searchform which displays just the list of names after certain search. what i want to do is when we double click on any of the names, it opens the mainform, which have all the details of the record and then after viewing i can go forward and backward just as i would have done when i open it directly. (when i go through search form it normally displays only one record). an example will be appreciated.
deepbreath@usa.net
 
Here is what you want:

Private Sub listofnames_Click()
On Error GoTo Err_listofnames_Click

Dim stDocName As String
Dim rst As Recordset, strCriteria As String
stDocName = "MainForm"


strCriteria = "[Name]=" & "'" & Me![listofnames] & "'"
DoCmd.OpenForm stDocName

Set rst = Forms!MainForm.RecordsetClone
rst.FindFirst strCriteria
Forms!MainForm.Bookmark = rst.Bookmark
Me!listofnames = ""
DoCmd.close acForm, "Search"

Exit_listofnames_Click:
Exit Sub

Err_listofnames_Click:
MsgBox Err.Description
Resume Exit_listofnames_Click


End Sub

Substitute the following;
listofnames: This is the txt box, or listbox, or combo box where the user selects the record he/she wishes to view
mainform: the name of your mainform
Name: Criteria that searches your records, in your case "names"?

HTH

Angelo
 
i tried but it gives a compile error, that a method or data member not found.
also my listofnames is displayed in a subform in datasheet view, from which i want to go to mainform
 
Ok, lets see.....
Is it possible for you to display the list of names in form view??
If not then I believe that you need to define where your list of names is more accurately.

strCriteria = "[Name]=" & "'" & Me![nameofsubform].[listofnames] & "'"

Could anyone else please give us a suggestion to what need to be done, thanks.

Angelo
 
sorry, still the same error, the code stops and highlight FindFirst......... stuck
 
open up a module and then go to the tools menu and select references. If anything with a check mark has the mord MISSING by it, uncheck that box. This should do it for you. Hope that helps.

Doug
 
Hmmm....
I don't really know what to say..
Could you post the code that you have for us to see?
 
i used the same code you told, with ofcourse the change of names, but it stops and gives the error. if you can direct me or send me some example this will be much appreciated thanx in advance
 
Do you have the Microsoft DAO Object Library Installed??? To get there, go to the modules tab and either go to design view of an existing module or create a new module. Go to the Tools menu and select references. See if one of the checked items up top are Labeled Microsoft DAO x.x Object Library. If not, then look through the list and check it. Then try again. If you created a new module to get to that menu, then you can close it without saving.

Doug
 

Users who are viewing this thread

Back
Top Bottom