![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
I want users to be able to store personal preferences for paths, layout, report dates, etc. I'm thinking to store the info in the following tables tblUser UserID* UserLastnam etc. tblUserPreference UserID* PreferenceID* tblPreference PreferenceID* PreferenceName PreferenceGroup PreferenceValue Problem is that I need to store values of different data types in the field PreferenceValue. My questions are: - How do I deal with the diffences in data type? Should I add a field for every data type? - If I enter a new user should I automatically add all Preferences to him or should I only add a preference if he wants to differ from the default value? - Or shouldn't I bother with normalisation in this case? Thanks, Lars |
#3
| |||
| |||
|
|
I want users to be able to store personal preferences for paths, layout, report dates, etc. I'm thinking to store the info in the following tables tblUser UserID* UserLastnam etc. tblUserPreference UserID* PreferenceID* tblPreference PreferenceID* PreferenceName PreferenceGroup PreferenceValue Problem is that I need to store values of different data types in the field PreferenceValue. My questions are: - How do I deal with the diffences in data type? Should I add a field for every data type? - If I enter a new user should I automatically add all Preferences to him or should I only add a preference if he wants to differ from the default value? - Or shouldn't I bother with normalisation in this case? Thanks, Lars |
#4
| |||
| |||
|
|
I would use text, then use IsNumeric() to determine if it's a number. I have also written a custom function to determine alpha (it's in my book g>) Public Function fIsAlpha(varIn As Variant) As Boolean On Error Resume Next fIsAlpha = Not Asc(LCase(Left(varIn, 1))) = Asc(UCase(Left(varIn, 1))) Exit_Here: Exit Function End Function -- Arvin Meyer, MCP, MVP http://www.datastrat.com http://www.accessmvp.com http://www.mvps.org/access Co-author: "Access 2010 Solutions", published by Wiley "Lars Brownies" <Lars (AT) Browniew (DOT) com> wrote in message news:htpit3$2rhe$1 (AT) textnews (DOT) wanadoo.nl... I want users to be able to store personal preferences for paths, layout, report dates, etc. I'm thinking to store the info in the following tables tblUser UserID* UserLastnam etc. tblUserPreference UserID* PreferenceID* tblPreference PreferenceID* PreferenceName PreferenceGroup PreferenceValue Problem is that I need to store values of different data types in the field PreferenceValue. My questions are: - How do I deal with the diffences in data type? Should I add a field for every data type? - If I enter a new user should I automatically add all Preferences to him or should I only add a preference if he wants to differ from the default value? - Or shouldn't I bother with normalisation in this case? Thanks, Lars |
#5
| |||
| |||
|
|
I want users to be able to store personal preferences for paths, layout, report dates, etc. I'm thinking to store the info in the following tables tblUser UserID* UserLastnam etc. tblUserPreference UserID* PreferenceID* tblPreference PreferenceID* PreferenceName PreferenceGroup PreferenceValue Problem is that I need to store values of different data types in the field PreferenceValue. My questions are: - How do I deal with the diffences in data type? Should I add a field for every data type? - If I enter a new user should I automatically add all Preferences to him or should I only add a preference if he wants to differ from the default value? - Or shouldn't I bother with normalisation in this case? Thanks, Lars you would be better with this structure |
#6
| |||
| |||
|
|
I would use text, then use IsNumeric() to determine if it's a number. I have also written a custom function to determine alpha (it's in my book <g>) Public Function fIsAlpha(varIn As Variant) As Boolean On Error Resume Next fIsAlpha = Not Asc(LCase(Left(varIn, 1))) = Asc(UCase(Left(varIn, 1))) Exit_Here: Exit Function End Function |
#7
| |||
| |||
|
|
you would be better with this structure tblUserPreference UserID* PreferenceID* PreferenceValue <- this is text, store numbers as text tblPreference PreferenceID* PreferenceName PreferenceType <-use this to store the value's type (number or text) PreferenceGroup PreferenceDefault <- see PreferenceValue Only store non-default preferences in TblUserPreferences. dLookup the user's preference value for a specified PreferenceId, if null use the default from tblPreferences. Use the PreferenceType to control which conversion function to apply to the value (cInt, cBool, cDouble, etc.) |
|
"Lars Brownies" <Lars (AT) Browniew (DOT) com> wrote in news:htpit3$2rhe$1 (AT) textnews (DOT) wanadoo.nl: I want users to be able to store personal preferences for paths, layout, report dates, etc. I'm thinking to store the info in the following tables tblUser UserID* UserLastnam etc. tblUserPreference UserID* PreferenceID* tblPreference PreferenceID* PreferenceName PreferenceGroup PreferenceValue Problem is that I need to store values of different data types in the field PreferenceValue. My questions are: - How do I deal with the diffences in data type? Should I add a field for every data type? - If I enter a new user should I automatically add all Preferences to him or should I only add a preference if he wants to differ from the default value? - Or shouldn't I bother with normalisation in this case? Thanks, Lars you would be better with this structure tblUserPreference UserID* PreferenceID* PreferenceValue <- this is text, store numbers as text tblPreference PreferenceID* PreferenceName PreferenceType <-use this to store the value's type (number or text) PreferenceGroup PreferenceDefault <- see PreferenceValue Only store non-default preferences in TblUserPreferences. dLookup the user's preference value for a specified PreferenceId, if null use the default from tblPreferences. Use the PreferenceType to control which conversion function to apply to the value (cInt, cBool, cDouble, etc.) |
#8
| |||
| |||
|
|
you would be better with this structure tblUserPreference UserID* PreferenceID* PreferenceValue <- this is text, store numbers as text tblPreference PreferenceID* PreferenceName PreferenceType <-use this to store the value's type (number or text) PreferenceGroup PreferenceDefault <- see PreferenceValue Only store non-default preferences in TblUserPreferences. dLookup the user's preference value for a specified PreferenceId, if null use the default from tblPreferences. Use the PreferenceType to control which conversion function to apply to the value (cInt, cBool, cDouble, etc.) Thanks Bob, I was a bit too hasty when typing the fieldnames. Indeed that was the idea. The problem is that I want to present the preference possibilities to the user as in other windows programs (Extra-Options etc.). So every preference must be visible as a field, also if a user hasn't set a value for it. I can't think of a query that gives the right result and remains editable as well. |
|
Other thing is that I want to use checkboxes for some preferences and I see no way of doing that when I store all values in a text field. a Checkbox can contain only true or false. Thets -1 and 0 as a |
|
Lars "Bob Quintal" <rquintal (AT) sPAmpatico (DOT) ca> schreef in bericht news:Xns9D875A45C2268BQuintal (AT) 69 (DOT) 16.185.250... "Lars Brownies" <Lars (AT) Browniew (DOT) com> wrote in news:htpit3$2rhe$1 (AT) textnews (DOT) wanadoo.nl: I want users to be able to store personal preferences for paths, layout, report dates, etc. I'm thinking to store the info in the following tables tblUser UserID* UserLastnam etc. tblUserPreference UserID* PreferenceID* tblPreference PreferenceID* PreferenceName PreferenceGroup PreferenceValue Problem is that I need to store values of different data types in the field PreferenceValue. My questions are: - How do I deal with the diffences in data type? Should I add a field for every data type? - If I enter a new user should I automatically add all Preferences to him or should I only add a preference if he wants to differ from the default value? - Or shouldn't I bother with normalisation in this case? Thanks, Lars you would be better with this structure tblUserPreference UserID* PreferenceID* PreferenceValue <- this is text, store numbers as text tblPreference PreferenceID* PreferenceName PreferenceType <-use this to store the value's type (number or text) PreferenceGroup PreferenceDefault <- see PreferenceValue Only store non-default preferences in TblUserPreferences. dLookup the user's preference value for a specified PreferenceId, if null use the default from tblPreferences. Use the PreferenceType to control which conversion function to apply to the value (cInt, cBool, cDouble, etc.) |
#9
| |||
| |||
|
|
You have the TblPreferences to start with. A form could show the PreferenceName Field in a listbox, allowing the user to click on one and poping up a form that shows the name, mayh some help text and has a textbox/checkbox/calendar/whatever to receive user input, the type being tied to the PreferenceType field. A save button then runs an appen or update query to add to TblUserPreferences, then closes the popup, and if necessary, requeries the listbox... |
|
Other thing is that I want to use checkboxes for some preferences and I see no way of doing that when I store all values in a text field. a Checkbox can contain only true or false. Thets -1 and 0 as a number, "T" of "F" as text, "Y" or "N" as text. what you need is a small function to translete "T" to -1 and "N" to 0. It is similar to the function required to translate "-7654321" to -7654321 |
|
"Lars Brownies" <Lars (AT) Browniew (DOT) com> wrote in news:htrese$ha1$1 (AT) textnews (DOT) wanadoo.nl: you would be better with this structure tblUserPreference UserID* PreferenceID* PreferenceValue <- this is text, store numbers as text tblPreference PreferenceID* PreferenceName PreferenceType <-use this to store the value's type (number or text) PreferenceGroup PreferenceDefault <- see PreferenceValue Only store non-default preferences in TblUserPreferences. dLookup the user's preference value for a specified PreferenceId, if null use the default from tblPreferences. Use the PreferenceType to control which conversion function to apply to the value (cInt, cBool, cDouble, etc.) Thanks Bob, I was a bit too hasty when typing the fieldnames. Indeed that was the idea. The problem is that I want to present the preference possibilities to the user as in other windows programs (Extra-Options etc.). So every preference must be visible as a field, also if a user hasn't set a value for it. I can't think of a query that gives the right result and remains editable as well. You have the TblPreferences to start with. A form could show the PreferenceName Field in a listbox, allowing the user to click on one and poping up a form that shows the name, mayh some help text and has a textbox/checkbox/calendar/whatever to receive user input, the type being tied to the PreferenceType field. A save button then runs an appen or update query to add to TblUserPreferences, then closes the popup, and if necessary, requeries the listbox... Other thing is that I want to use checkboxes for some preferences and I see no way of doing that when I store all values in a text field. a Checkbox can contain only true or false. Thets -1 and 0 as a number, "T" of "F" as text, "Y" or "N" as text. what you need is a small function to translete "T" to -1 and "N" to 0. It is similar to the function required to translate "-7654321" to -7654321 Lars "Bob Quintal" <rquintal (AT) sPAmpatico (DOT) ca> schreef in bericht news:Xns9D875A45C2268BQuintal (AT) 69 (DOT) 16.185.250... "Lars Brownies" <Lars (AT) Browniew (DOT) com> wrote in news:htpit3$2rhe$1 (AT) textnews (DOT) wanadoo.nl: I want users to be able to store personal preferences for paths, layout, report dates, etc. I'm thinking to store the info in the following tables tblUser UserID* UserLastnam etc. tblUserPreference UserID* PreferenceID* tblPreference PreferenceID* PreferenceName PreferenceGroup PreferenceValue Problem is that I need to store values of different data types in the field PreferenceValue. My questions are: - How do I deal with the diffences in data type? Should I add a field for every data type? - If I enter a new user should I automatically add all Preferences to him or should I only add a preference if he wants to differ from the default value? - Or shouldn't I bother with normalisation in this case? Thanks, Lars you would be better with this structure tblUserPreference UserID* PreferenceID* PreferenceValue <- this is text, store numbers as text tblPreference PreferenceID* PreferenceName PreferenceType <-use this to store the value's type (number or text) PreferenceGroup PreferenceDefault <- see PreferenceValue Only store non-default preferences in TblUserPreferences. dLookup the user's preference value for a specified PreferenceId, if null use the default from tblPreferences. Use the PreferenceType to control which conversion function to apply to the value (cInt, cBool, cDouble, etc.) |
#10
| |||
| |||
|
|
I want users to be able to store personal preferences for paths, layout, report dates, etc. I'm thinking to store the info in the following tables tblUser UserID* UserLastnam etc. tblUserPreference UserID* PreferenceID* tblPreference PreferenceID* PreferenceName PreferenceGroup PreferenceValue Problem is that I need to store values of different data types in the field PreferenceValue. My questions are: - How do I deal with the diffences in data type? Should I add a field for every data type? - If I enter a new user should I automatically add all Preferences to him or should I only add a preference if he wants to differ from the default value? - Or shouldn't I bother with normalisation in this case? Thanks, Lars |
![]() |
| Thread Tools | |
| Display Modes | |
| |