Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to link a data field dynamically based on the selected item

Status
Not open for further replies.

megoon

IS-IT--Management
Dec 11, 2003
21
0
0
DE
Hi folks,

I have two tables:
table1: descriptive weekdays --> monday, tuesday,..., sunday
table2: numerical weekdays --> 1, 2, ...,7

These two tables have been linked together with refereential integrity.

In my form I have a select box, which contains the data from table1. In a, say text field I want to display the weekday "in numerical form" based on the selection I made before in the select box. That is, as I select an item in the select box and go to the next control element this field with the numerical weekday should be changed, respectively (if sunday is selected, the text field should display 7, as I hit on enter).

Does anyone have an idea how to accomplish this task?

Thank you for any help!
 
Just setup a switch statement. It will take in the value you select from the drop down. And then for each of your cases, you will assign the appropriate value to your textbox.

I don't know the reason you have these tables, but if this is the only reason, then you could eliminate one of them. You could easily accomplish this using only code. Thus reducing the amount of tables in your database. :)
 
m,

You could use an on_current event to put the day of the week in a textbox.

MyWeekDay = Weekday(MyDate) ' chek help F1 to see this

This shows the days of the week as numerics - 1-7

startcode

me.txtDayOfWeek = weekday(me.date1)

endcode

If your form variable is date1 and the line of code above used in the on_current event, the day number will show up with each suceeding record.

R
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top