Dlookup & VB Prob.

P

Paul

Have a problem, because my knowledge of access is very bad.
Please could you help me with the following:

I have a form with the swimming club members. Each member
has thier name address etc. On it too I have a members
swimming best times record. I had to arrange them in the
following manner:
FC25 FC50 FC100
BC25 BC50 BC100
BF25 BF50 BF100
FS25 FS50 FS100

Each of the above are fields representing thier best time
for each event. Each of the above is arranged by stroke
and distance (FC = Front Crawl, BC = Back Crawl, BF =
ButterFly, FS = Free Style) and the numbers are the
distances.

OK - that explained

Now, I have a results form with a list of members that
competed into a race of a certain stroke and distance with
thier times. I want to, with a command button, to look up
thier previous record on thier members table, and find out
if the new time in the event is faster/better than thier
previous.

The problem I first had was to establish a link with the
one event result and thier records. What I did was I
looked up the stroke and distance on the event's results
form and made an invisible field represent the
stroke/distance. In VB I got working if the stroke
is "Front Crawl" then the invisible field is FC. Same for
distance - if distance is "25 metres" then invisible field
is same + "25". This would give me FC25. This would be an
instance of Front Crawl 25 metres and so each member's
time would be looked up using thier memberID and look up
the field eg FC25.
Now what I need to do is using the lookup tool and some
calculation, i need to lookup the previous record using
the memberID and compare it to the new time. If the new
time is faster then the dlookup tool would update it with
the new time. I just need the VB code calulations and
dlookup code together with the certain field eg "FC25".

If you could help me with the following then it would be
greatly appreciated.

The members table is "Members Table"
The results form is "Results Form"
The members ID is "MemberID"
The invisible field on the Results Form which hold the
information eg "FC25" is called "TempField"
 
C

chipmunkwhiz

What are the fields in your main table? I am a bit confused by your
discription.
If I had to build this database, I would use a main table containing
Date
Swimmer ID
Stroke
Distance
Time
Then some linked tables containing:
Swimmers: ID, Name, other pert. info

Strokes:ID, Description

Distances: Distance info

Then You could build a form that when you bring up the swimmer,
possibly from a combo box you could have other unbound textboxes filled with
the swimmers last times using
Dlast("[Time]","[MainTable]","[MainTable].ID=[Forms]![swimmerinfo]![ID]")
or for best time,
DMax("[Time]","[MainTable]".,]","[MainTable].ID=[Forms]![swimmerinfo]![ID]")

Hopefully this helps some, I'm not the best teacher.
 

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