Using mini table in top corner to shift focus of main table

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

http://i9.photobucket.com/albums/a66/bubbajoe12345/workspace.jpg
I've created a nice form for entering/viewing information into the record --
works for viewing the records as well. But, when paging through the form,
using the default arrows to go to: First, Previous, Next, Last, New, I can't
see how many names are between the person I'm looking at and the person that
I want to look at. Should I got to the "Next" record 50 times? Would it be
faster to skip to the end then move backwards through the records? So I put
a mini box with just the names of people in the top left corner of the form.

I want to make it so that, when a name in the top left corner box is
clicked, the main form shifts focus to that person. Right now (excepting the
top left box which isn't linked to anything), the form is linked through
social security # (Soc Sec #). Whenever the main area is moved to a new
person, the subtables shift to display the corresponding information.

So, how can I link them such that selecting a name from that top left corner
will change the person in the main body of the form (which would then do as
it does now and change the subtables to reflect what's happening)?
 
I would change things slightly:

First, I would turn off record selectors on your form. That should
align the graphics you have a little better.


Next:

Change the subform to a listbox (or combo box). If you use a combo
box, turn on the wizard and walk through the option of "Find a record
based on the value I select". It will generate all the needed code.

Now, right click on it, and select "Change to: List Box". The code
should continue to work.


If you want to maintain the way you are doing it, you will have to
write some code on the OnCurrent event of the subform, and set the
subforms Parent form Recordset Bookmark to the value of what you
selected following the guidance of the code generated by the wizard.
All in all, not too terribly different or difficult. Let me know if
you need more help.


Chris Nebinger
 
I realize that I'll have to requery the mainform from the minitable (the
subform), but I'm not really sure how to do this. Me.Parent.Requery but
where does that go? I've figured that I need to add the following to the
main form element:
Where [Soc Sec#] = Forms![Apprentice Information]![Apprentice Information
Subform]![Soc Sec#];
but unlike queries where I can right click on the blank area at the top to
open up box where I can enter straight SQL, I haven't yet figured out how to
edit the SQL statements of forms.

I also have no idea how to "turn on the wizard".

Thanks for your help so far :D
 
For the wizard, on the Toolbox menu, there is a icon with the picture
of a wand. That's the wizard.

For now, this should work, but I don't know for sure the name of your
controls:

On the subform

Private Sub Form_Current()
'Using Reference to DAO:
Dim rst as DAO.Recordset
'Using late binding
'Dim rst as Object
Set rst = Me.Parent.Recordset.Clone
rst.FindFirst "[Soc Sec#]=" & Me.Controls("Soc_Sec#") 'Check that
name for the control name
If Not rst.EOF Then Me.Parent.Bookmark = rst.Bookmark
End Sub


I still think this would be better with a list box, but that's a design
decision.


Chris Nebinger
 
Thanks. I had a list box originally, but the people I'm working with really
wanted to be able to type in a name and have the box jump to that.
 
Back
Top