Dlookup question

G

Guest

I am working on a form that I can enter and track golf scores for each hole.
When I select the course I played (form field Course), I want the Par for
each hole to show on the form. I have a separate table listing all the
courses (table Courses) with field CourseName) and par1, par2, par3 as fields
for par. From my understanding I would use the DLookup function. How would
I use this?
 
V

Van T. Dinh

Do you mean you have Par1, Par2, Par3, ..., Par18 as the Fields in Table
[Courses]?

If that the case, you have an incorrect Table Structure since the set of
Fields indicate:

* You have repeating groups (eacg group has 1 Filed in your Table) which
violates the Relational Database Design Principles.

* The data (Hole 1 to Hole 18) is stored in the Field names rather than in
the Field values. All database engines are designed to retrieve data in
Field values in records / rows efficiently but not from Field names.

You may need to modify your Table Structure before proceeding further in the
development of your database.
 
G

Guest

The DLookup function has tree parts;

the Expression (required) - which represents the value you want to lookup

the Domain (required) - which represents where you want Access to look for
the value

the Criteria (optional) - which is used to limit or control which value is
returned

the syntax looks like;

DLookup(expression, domain, criteria)

I don't know anythig about your DB, so I'm guessing here, but it might look
something like;

DLookup("ParID", "tblCourses", "CourseID =" & Me![CourseID])

HOWEVER, having said that, this doesn't seem like the type of information
that you should have to *lookup*. I've never created a golf DB before, but it
seems like, if your tables and forms are designed correctly, the par for each
hole would already be displayed. For example;

You would have a form where you would enter things like;

Course Name
Date Played
Tee Time
Persons in your group
Number of beers consumed during round
Etc.

Then there would be a subform that would display information about each hole
for that particular course like;

Hole Number
Par (for that hole)
Score (your score for that hole on that date)
Result (maybe an unbound textbox that would display "birdie", "bogie", etc.)

Like I said, never done a golf DB, so it's just my opinion. Maybe you have
reasons for doing it another way.

HTH
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top