Variable/Function used as Control for TextBox

P

pretzel

Hi,
Have tried all I have read on this site as well as on-line help etc, but I'm
sure that this can be done.

I'm building a db for a Swim Club. I'm recording Times/Dates/etc for each
Swimmer for around 39 diffent events. I'm recording the Minutes and Seconds
in two separate fields in a table and displaying them using =[sc50mB/Fly-m] &
":" & [sc50mB/Fly-s] as the Control in a TextBox. All OK so far.

To edit the time, I'm using a "EditTime" button for each event (39 buttons)
which brings up a form (EditSwimTime). I can use a different form for each
event (39 forms) but would rather use one.

This requires that pressing the button initiates variables for which the
value is passed to the EditSwimTime form.

My test button sets the variables using:
strCourse = "Short Course"
strLS = "sc"
strDist = "50m"
strStroke = "B/Fly"

I have created a new module and inserted code such as:
Global strCourse As String, strLS As String, strDist As String, strStroke As
String

Function GetCourse() As String
GetCourse = strCourse
End Function

I then use =GetCourse() in the Control of a TextBox on EditSwimTime & it all
works fine.

The problem is getting the time information from the table (there are two
tables that hold the times, ShortCourse and LongCourse)

I have created a function:
Function GetMinTime() As String
GetMinTime = strLS + strDist + strStroke + "-m"
End Function

I then use GetMinTime() as a Control in a TextBox on the EditSwimTime form,
but all it returns is sc50mB/Fly-m (the field that holds the Minitue value)
rather than returning the value in the field.

I have tried several differring structures, none of which work. I presume it
is incorrect syntax (maybee).

Any ideas?


Thanks in advance
 
A

Arvin Meyer [MVP]

Why don't you use a table with a field for EventID and EventName, then in
your main table you simply need an EventID field for each row. The main
table should probably look like:

PrimaryKey - AutoNumber
PersonID - Long from tblPerson
EventID - Long from tblEvents
Time - Double

That brings together everything we need to know about the event, the person,
and the time. From here, we can calculate all the information required.
--
Arvin Meyer, MCP, MVP
Microsoft Access
Free Access downloads
http://www.datastrat.com
http://www.mvps.org/access
 
P

pretzel

OOPS

Please disregard this post as I have an earlier posting on the same topic.

I had re-entered this posting as my previous attempt dosn't appear in my
profile, so I thought it wasn't saved.

Oh well.....
 

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