Hi,
I have create a database application and now I am confronted with the
following user requirement:
In the database the first name, last name and initials of a person are
stored.
A user should be able to set a personal preference on how lookup
comboboxes with person names in it should behave. Three different
options should be available:
[FirstName] & " " & [LastName] (e.g John Doe)
[LastName] & ", " & [FirstName] (e.g. Doe, John)
[Initials] (e.g. JD)
I store this preference in a table tblConfig as either option 1, 2 or 3.
But now the difficult part: how to make the displayed column in the
combobox dependent on the user preference? Something like:
Case option 1
Display: [FirstName] & " " & [LastName]
Case option 2
Display: [LastName] & ", " & [FirstName]
Case option 3
Display: [Initials]
I hope my question makes sense. All help is highly appreciated!
Regards,
Els 3 1197
In your select statement, builld the complete query for each case,
then after the End Select, set the row source to that query:
Select Case
Case 1
q="SELECT [FirstName] & ' ' & [LastName], ......"
Case 2
q="SELECT [LastName] & '. ' & [FirstName]..."
case 3
q="SELECT Initials,..."
End Select
me.cboWhatever.RowSource = q
Depending on the length of the query you could clean up the code, too.
On 01 Mar 2004 19:29:38 GMT, Els <El*@nospam.com> wrote: Hi,
I have create a database application and now I am confronted with the following user requirement:
In the database the first name, last name and initials of a person are stored.
A user should be able to set a personal preference on how lookup comboboxes with person names in it should behave. Three different options should be available:
[FirstName] & " " & [LastName] (e.g John Doe) [LastName] & ", " & [FirstName] (e.g. Doe, John) [Initials] (e.g. JD)
I store this preference in a table tblConfig as either option 1, 2 or 3.
But now the difficult part: how to make the displayed column in the combobox dependent on the user preference? Something like:
Case option 1 Display: [FirstName] & " " & [LastName] Case option 2 Display: [LastName] & ", " & [FirstName] Case option 3 Display: [Initials]
I hope my question makes sense. All help is highly appreciated!
Regards,
Els
Thanks Larry, and where do I implement this kind of code? The BeforeUpdate
event of the combobox?
Another question: Is it best to read the preference settings each time from
the table or should I read it once and declare a public variable? What is
best practice?
Regards, Els
Larry Johnson <la***@gjerager.com> wrote in
news:hr********************************@4ax.com: In your select statement, builld the complete query for each case, then after the End Select, set the row source to that query:
Select Case Case 1 q="SELECT [FirstName] & ' ' & [LastName], ......" Case 2 q="SELECT [LastName] & '. ' & [FirstName]..." case 3 q="SELECT Initials,..." End Select me.cboWhatever.RowSource = q
Depending on the length of the query you could clean up the code, too.
If the option value is in a preference setting, the code should
probably go in go in Form_Load.
On when to read the settings, you'll find a variety of opinions. If an
application has a main menu form (frmMenu) with buttons to open other
forms (frmWork) to do the work, I read each time preferences in
frmWork's Form_Load. That way if you have an error, opening the form
again sets the preferences properly. If you just do it once in the
frmMenu you'd have to go into design view for frmMenu to read the
preference.
On 01 Mar 2004 23:13:27 GMT, Els <El*@nospam.com> wrote: Thanks Larry, and where do I implement this kind of code? The BeforeUpdate event of the combobox?
Another question: Is it best to read the preference settings each time from the table or should I read it once and declare a public variable? What is best practice?
Regards, Els This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Lucas Lemmens |
last post by:
Dear pythonians,
I've been reading/thinking about the famous function call speedup
trick where you use a function in the local context to represent
a "remoter" function to speed up the 'function...
|
by: Koen |
last post by:
Hi all,
My application uses a lot of lookup tables.
I've splitted the frontend (forms, reports, etc) from the backend (data).
The database has around 10 different users.
The values in the...
|
by: my-wings |
last post by:
I've been reading about how evil Lookup fields in tables are, but I've got
to be missing something really basic. I know this subject has been covered
before, because I've just spent an hour or two...
|
by: google |
last post by:
I have a database with four table. In one of the tables, I use about
five lookup fields to get populate their dropdown list. I have read
that lookup fields are really bad and may cause problems...
|
by: Shug |
last post by:
Hi,
We need a C++ beautifier, and due to the specific requirements of some
of our developers, it has to be very configurable. After trying some
free ones, we now realise that we might need to...
|
by: paul.joseph.davis |
last post by:
Hi,
I've just had my first encounter with two-phase lookup and I'm
scratching my head a bit. The idea behind two phase look up is pretty
easy to understand, but I have a case that fails to...
|
by: =?Utf-8?B?U2ltb25EZXY=?= |
last post by:
Hi All
I would like to install the same Windows Service project on the same server
under different names, one for each customer. I have been able to do it but
I would like an expert opinion as...
|
by: ianoble |
last post by:
I've been trying to piece together various code snippets to create a lookup table inside my xslt without the need for a supplemental xml file. Here is what I have so far. As of now, it does not...
|
by: joeino |
last post by:
I want to do a lookup query and append the record to a history table before editing the data.
I created a macro to run the lookup query to append the record to history and it works fine. I did the...
|
by: DolphinDB |
last post by:
Tired of spending countless mintues downsampling your data? Look no further!
In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
|
by: ryjfgjl |
last post by:
ExcelToDatabase: batch import excel into database automatically...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: jfyes |
last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
|
by: PapaRatzi |
last post by:
Hello,
I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
|
by: CloudSolutions |
last post by:
Introduction:
For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
|
by: Shællîpôpï 09 |
last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
|
by: af34tf |
last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
|
by: Faith0G |
last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
| |