ant! said:
Gina,
thanks for your response.
imagine you are in a doctor's surgery.
he has a long list of patients.
You say my name is Gina; so he clicks on Gina and then a page with your
details come up.
That is what I am trying to make.
In my head it all seems so simple....
Thanks
All the advice you've had so far is correct, and well-targeted, but I
think you've now given us a clear description of what you need. Here's
what I'd suggest:
First (absolutely the most important and least obvious stage), make sure
you have your table(s) right. Most databases have several related
tables, and you may find you need to go down this route as you enhance
your database, but for now there is just one table. That means we can
even base our form directly on the table, instead of on a query which
joins multiple tables together. (These considerations may not be
relevant now, but they are too important not to mention!)
You need a form, and for now you'll create a form which will show ALL
the records (1 patient = 1 record) in your database. You move from one
record to the next using the controls ("VCR controls") at the bottom of
the form - Access adds these controls automatically.
The easiest way to create a form is to use the Wizard. In my experience
the best way to do this is to just try it loads of times, varying the
options, and deleting the resulting forms until you have one you like.
If you want, you can change into Form Design View and nudge things about
a bit until you have exactly what you want.
But what about selecting an individual patient to view? That's a
"search" facility. What you want is to type in a name, or some part of
a name, and have Access display only those patients which match. You
suggested "Gina" as an example. What if this patient (Gina Whipp) had
said "Whipp"? Or what if the name was John? In the first case you see
you need to match any part of the name (from either Given Name or Family
Name) and in the second case you're likely to get quite a few matches.
One solution to the first problem is to create a query, and base the
form on the query, not the table. The query "concatenates" the First
Name and Last name using an expression like this:
FullName:=[FirstName]&" "&[LastName]
.... so now you have a single field which will contain any part of the name.
Create such a query, and use the Form Wizard to create a form, and that
field (which I've called FullName) will appear on your form.
Now you have to search. I'd suggest you start with the built-in
"filter" facility in Access. No coding - it just works. Find and click
the "filter-by-form" button on the toolbar. This brings up a version of
your form into which you can enter search text into one or more of the
fields. You should use wildcards ('*' means any characters and '?'
means any single character) if you want to match entries which are
longer than what you type. For example, if you wanted to match "Gina
Whipp" in the FullName field, you could enter:
*na w*
- note the wildcards before and after. Alternatively you could enter:
Gin*
- which would match any records starting with the string "Gin".
To complete the search, you have to click the "Filter" button, which
looks like a funnel. Then you'll see your form displaying the first of
the matching records. You can click the "Next Record" button in the VCR
controls until you see the one you want. If too many records have been
matched, start again and enter a more specific search term.
Why don't you try that and see if it does the job for you. You could
have this working in less than an hour - depending on how long it takes
to create a form you're happy with.
Yes, it's possible to customise this process, and include a search
button on your form. You'd create an unbound text box, and a button.
In the OnClick event of the button you'd use VBA to set the form's
"filter" property to be the contents of the text box, and then turn the
filter on. Same effect. And yes, you can refine all this in lots of
different ways so that a form pops up. There are many possibilities,
and if you study this very comprehensive demonstration site:
http://allenbrowne.com/ser-62.html
.... you'll see how most of them work.
Access can seem very hard for an absolute beginner but it's worth
sticking with it, as it all starts to make sense with time. Lean how to
divide your data into related tables and use the Relationship window to
"tell" Access about the relationships. Use Queries to "join" your
tables to access related information. Base Forms and Reports on your
Queries. Use Wizards at every stage until you're confident enough to
construct a table, query, form or report from scratch. Access will help
you if you go about things the right way. And so will we.
HTH
Phil