I am new to Access, I am more familiar with FileMaker but wanted to keep with software that we have. I have a list of software, I want to set it up so that if I click a record in the list it will go to that particular software title's form layout. I can do this where it shows *ONLY* the particular record, but I am looking for it to basically navigate to the selected software form, but still allows you to navigate through *ALL* other software titles in the form view. If you can help me figure this out in easy to understand terms *newby*, I'd be greatly appreciative!
Open form to a specific Record, but show all records
Collapse
X
-
jucream,
Welcome to Bytes. As a newby to Access, you'll want to spend some time with the Northwind sample database. Check under your Access Help menu to find that.
As for your immediate need, see this thread, #3. http://bytes.com/topic/access/insigh...ogrammatically
You're going to want to put your record navigation in the OnOpen even of the form. So it will open with the entire recordset but then the code will just advance you to the record you specify.
Good luck, and let us know how you make out. We're here to help.
Jim -
Thank you, jimatqsi! I actually just figured out how to open the Northwind database that has 'Design View' so that will be super helpful.
I didn't quite understand the info in the links, but it directed me to refine my searching and I came up with something that is working. Is there any negative to using this as opposed to the info on your link, it seems to be working as I hoped, I just want to make sure it doesn't break down the road?
Code:Private Sub ID_Click() On Error GoTo Err_Go_to_Click Dim stDocName As String Dim stLinkCriteria As String stLinkCriteria = "ID = " & Me.ID stDocName = "Software" 'Open the form with no filter DoCmd.OpenForm "Software" 'Go to the specified record Forms(stDocName).Recordset.FindFirst stLinkCriteria Exit_Go_to_Click: Exit Sub Err_Go_to_Click: MsgBox Err.Description Resume Exit_Go_to_Click End SubComment
-
What's going on here is that you are opening one form from another form and then kind of moving that opened form to a specific record sort of like by remote control. It looks just fine like that without knowing anything about the operating environment or specific needs of the user. You would do well to study what you have done and what the other link is demonstrating - 3 ways to advance to a record. That link is not about controlling one from from another, it's simply demonstrating moving around within a recordset. Within the active form or another form is kind of beside the point.
Glad you solved your problem.
jim
JimComment
-
Thanks Jim! That is what I was looking for, I have a list of software, when choosing from the list I wanted it to open to a form view and display that particular software title (what was clicked on) but still allow the user to navigate amongst the other software titles within the form view. I am trying to come up with an easier method of tracking software licenses and installations for my department as the current spreadsheet method is getting out of hand and hard to follow. It'll be used by a couple of us and probably no more than 1 person at a time.Comment
-
Simply-put, controlling record navigation within a form involves the following steps (although there may be alternative approaches) :
I assume that we start from a point where information that identifies the required record uniquely is available to us from the start.- When the form (We'll refer to this object as {Form}.) is open we use code to navigate to the required record in {Form}.Recordse tClone. {Form}.Recordse t could be used but doesn't allow so easily for any error handling (Not included here).
- We'll refer to the identifying info as strID and the Field that stores the data to be matched as [ID]. I've assumed for the purpose of this snippet that the ID data is textual. See Quotes (') and Double-Quotes (") - Where and When to use them for handling other data types in SQL literals.
- Code:
Dim strWhere As String, strBM As String strWhere = Replace("[ID]='%I'", "%I", strID) Call {Form}.RecordsetClone.FindFirst(Criteria:=strWhere) ' Error handling may go here. {Form}.Recordset.Bookmark = {Form}.RecordsetClone.Bookmark
Comment
Comment