Having a list of record names displayed and opening the full record via click (1 Viewer)

AWilderbeast

Registered User.
Local time
Today, 16:18
Joined
Sep 13, 2005
Messages
92
Challenge Here :List of record names displayed and opening the full record via click

Im not sure if this is the right place to put this but I was wondering if you could help me:

Say I have database with forms that display records or people ie name, address, postcode, etc. What I want to do is display a list of Names then from that list I can double, single click and open the record details.

Id call my self and amatuer at access and am probably guessing this is done via vscript or something else, but any help will do.

Thanks
Alex
 
Last edited:

freakazeud

AWF VIP
Local time
Today, 12:18
Joined
Sep 10, 2005
Messages
221
Hi,
several methods you can do this with.
First of all what list do you want to do to display your names! You can use a listbox or combobox so the user can make a selection. Use the combobox wizard to create a combo based on the key field in your record and the name field.
You can format the combo to just show the names by opening its properties and under format do column count 2 and column width 0,1. Now the key column is hidden and just the names are displayed. Now you need to figure out what event you want your action to take place (after update, on click, on double click...). You can use a main form subform set up to to have the combo on the main form to make the selection and then the details (whole record) in the subform. When the selection is made the subform will display the appropriate info. OR you can open a seperate form to show this info if you want, but I would keep it together.
So create a new form based on your table. Include all fields you want. Then link the main and subform on the key column (master/child relation). Now on the after update event of the combo you can do some vba (visual basic for application) like this:

Dim rs As Object

Set rs = Me.Recordset.Clone
rs.FindFirst "[YourIDField] = " & Str(Nz(Me![YourCombo], 0))
If Not rs.EOF Then Me.Bookmark = rs.Bookmark

Untested, but should work...!
HTH
Good luck
 

OxDavis

Registered User.
Local time
Today, 10:18
Joined
Jul 14, 2005
Messages
74
Could you expound on this? I have 3 tables: Case, Parents, and Events.

Case--->Parents--->Events (all 1 to many relationships)

In my tblCase input form I would like a combo box for parent names that brings up their events in a subform. What is the proper vba code to achieve this?
 

AWilderbeast

Registered User.
Local time
Today, 16:18
Joined
Sep 13, 2005
Messages
92
Hi i managed to follow your tutorial but the visual basic bit doesnt work. Also how do i do the relationship bit and could that be why its not working

Thanks
 

AWilderbeast

Registered User.
Local time
Today, 16:18
Joined
Sep 13, 2005
Messages
92
can someone please help me out here, i have list of names in a list box and i want to open a full record of client once the name has been double clicked anyone help?
 

OxDavis

Registered User.
Local time
Today, 10:18
Joined
Jul 14, 2005
Messages
74
Is there a sample database or public VBA script to which someone could point us? I've searched the repository above but to no avail.
 

freakazeud

AWF VIP
Local time
Today, 12:18
Joined
Sep 10, 2005
Messages
221
There you go!

Hi,
sorry guys. Wasn't around yesterday...hope this will still help you!
I fast put together a sample you should be able to use to figure out how to do this!
HTH
Good luck
 

Attachments

  • db3.zip
    50 KB · Views: 259

OxDavis

Registered User.
Local time
Today, 10:18
Joined
Jul 14, 2005
Messages
74
Ok, that was great got it to work thanks. But one more question. The form you included would be the subform on my main data entry page. When I drop ther combo box down, I see a list of ALL the names, not just the ones associated with the Master form I have open. While I cannot select names from the combo box that are not associated with the current Master open record they are still visible and, based upon the quanitity of names I plan to have in the database, the combo box will be useless if it displays every name, rather than only the ones I have associated with the current record on the Master form.

So: How do I get the combo box to only display the options associated with the current open record on the Master form?
 

freakazeud

AWF VIP
Local time
Today, 12:18
Joined
Sep 10, 2005
Messages
221
Hi,
what do you mean? I'm not understanding your request.
The combobox is on the main form to make it possible for a user to make a selection to further see the details of the selection made. If the combobox would only show one value then there would not be any way for the user to select someone else to display the details of that record! This would then eliminate the purpose of a combobox. If a user doesn't need to make a selection then no need for a combobox.
So what is it you are trying to achieve?
HTH
Good luck
 

OxDavis

Registered User.
Local time
Today, 10:18
Joined
Jul 14, 2005
Messages
74
Ok, the entirety of the form you posted is actually a subform of another form that I have. So if say I was on record "Musicians" I could only select Ringo, etc. from the subform, that would bring up their record in the subsequent subform.
 

AWilderbeast

Registered User.
Local time
Today, 16:18
Joined
Sep 13, 2005
Messages
92
Still having trouble

Hi thanks for you example but im still having trouble with doing it myself i have attached a datbase with what i have managed to do so far which is not alot i just need the event proceedure to work could you input it for me and attach again so i can see what i need to do for my other forms.

Thanks
Alex
 

Attachments

  • help me.zip
    22 bytes · Views: 155

freakazeud

AWF VIP
Local time
Today, 12:18
Joined
Sep 10, 2005
Messages
221
Hi,
your attachment comes up blank. There is nothing in the zip file...at least not for me? Maybe you need to rezip and repost and make sure the file contains data.
Thanks!
 

AWilderbeast

Registered User.
Local time
Today, 16:18
Joined
Sep 13, 2005
Messages
92
Help

Hi, dont know what happened musnt of zipped probably here it is again i have checked it this time and its there

Thanks for your help
 

Attachments

  • help me.zip
    16.3 KB · Views: 161

freakazeud

AWF VIP
Local time
Today, 12:18
Joined
Sep 10, 2005
Messages
221
Hi,
I looked at your db. I don't really know if that is your actual db or not, but your table structure is not correct. Your data is normalized. But then again you have hardly any structure or data, so I just fixed it so it works on the form, but you might want to read up on normalization if you get into building your whole/real application. Normalization and data strcuture is one of the most important things in db design. Everything is based on it and if something is incorrect you will later on run into problems.
HTH
Good luck
 

Attachments

  • help_me01.zip
    21.5 KB · Views: 187

Jwy

Registered User.
Local time
Today, 10:18
Joined
Sep 19, 2005
Messages
10
Oliver,

What would the code look like if you wanted to display the selected detail record on a separate form. I am trying to accomplish the same thing, but using a separate main form for the list box and a separate main form to display the detail. I need my list box to be filtered, as I will have several views of the database. I will just replicate this code for my different views once I get the data selection and display correct.

Kindest regards,

Jwy
 

freakazeud

AWF VIP
Local time
Today, 12:18
Joined
Sep 10, 2005
Messages
221
Hi,
you would just need to parse the arguments given from the listbox to the open event of the form.
Depending on what your values are chose on from below:

If Number:

DoCmd.OpenForm "YourForm", , ,"[YourID] = " & Me.YourListbox

If the ID is Text:

DoCmd.OpenForm "YourForm", , ,"[YourID] = '" & Me.YourListbox & "'"

HTH
Good luck
 

AWilderbeast

Registered User.
Local time
Today, 16:18
Joined
Sep 13, 2005
Messages
92
What am I doing wrong?

Hi again, ive been using the example you made for me to try and create some of my own ive tried opening a seperate form and I tried doind the subfrom one. But neither work when I have exactly what you put. can you have a look at this datbase and tell me what im doing wrong?

Thanks
 

Attachments

  • db2.zip
    26 KB · Views: 115

freakazeud

AWF VIP
Local time
Today, 12:18
Joined
Sep 10, 2005
Messages
221
Hi,
you didn't establish a link between main form and subform!
Open the subforms property window and check in the data tab. You will find child and master link! You have to establish both. Since bus_Id is your id field which both contain that's your child and master link. I created it for you and the form works now! check attachment!
HTH
Good luck
 

Attachments

  • db2_new.zip
    25.5 KB · Views: 126

AWilderbeast

Registered User.
Local time
Today, 16:18
Joined
Sep 13, 2005
Messages
92
Still Dont work for me how do i bound?

Hi I had a look at what you did and found it all but when i try do it mysef i get 'cant create link between unbound forms' how do i bound them? also if you have another look at the forms on my sample database i tried to make them open in a new window too using the vbscript you posted but i cant ge that to work either can you tell me what i did wrong there please?

Thanks
 

Users who are viewing this thread

Top Bottom