473,769 Members | 2,337 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Combo Box inital value to display

I have a combo box that displays the names of all the users in my "Users"
table. I set the RowSource to a Query from the "User" and "Project" tables.

I can select any name from the list and that name comes up in the combo box
on the form. Everything works fine this way I just want to automatically
put the user name in the combo box display.

Is there a way to automate displaying a name in the combo box without having
to use the drop down.

I get the current users ID number by using an API call (thanks to Ken Getz).

After the call returns the ID I take that value and place it in a hidden
textbox on my main form.

????? How do I get the name from the "User" table that matches this ID to
displayed in the combo box? The combo box is already populated with names.
?????

I tried using the RowSource property with a select statement but that only
limited the list to the user name that matched the ID. It did not display
it in the combo box though, you still had to select it. I figured that was
because the RowSource property only puts data in the rows and does not do
the displaying of the data.

I do not want to lose the list of users, I just want to display the logged
in one.

I use the ID to filter the records in a list box on the form and other
things.

Thanks.

Dave N
Nov 12 '05 #1
2 3012
"Dave N" <ne*********@jo hndeere.com> wrote in message
news:3f******** @news1.dpn.deer e.com...
I have a combo box that displays the names of all the users in my "Users"
table. I set the RowSource to a Query from the "User" and "Project" tables.
I can select any name from the list and that name comes up in the combo box on the form. Everything works fine this way I just want to automatically
put the user name in the combo box display.

Is there a way to automate displaying a name in the combo box without having to use the drop down.

I get the current users ID number by using an API call (thanks to Ken Getz).
After the call returns the ID I take that value and place it in a hidden
textbox on my main form.

????? How do I get the name from the "User" table that matches this ID to displayed in the combo box? The combo box is already populated with names. ?????

I tried using the RowSource property with a select statement but that only
limited the list to the user name that matched the ID. It did not display
it in the combo box though, you still had to select it. I figured that was because the RowSource property only puts data in the rows and does not do
the displaying of the data.

I do not want to lose the list of users, I just want to display the logged
in one.

I use the ID to filter the records in a list box on the form and other
things.

Thanks.

Dave N


Try setting the Default value. Use the Dlookup function to convert the ID to
Username.
Fred Zuckerman
San Diego, CA, USA
Nov 12 '05 #2
"Dave N" <ne*********@jo hndeere.com> wrote in message
news:3f******** @news1.dpn.deer e.com...
I have a combo box that displays the names of all the users in my "Users"
table. I set the RowSource to a Query from the "User" and "Project" tables.
I can select any name from the list and that name comes up in the combo box on the form. Everything works fine this way I just want to automatically
put the user name in the combo box display.

Is there a way to automate displaying a name in the combo box without having to use the drop down.

I get the current users ID number by using an API call (thanks to Ken Getz).
After the call returns the ID I take that value and place it in a hidden
textbox on my main form.

????? How do I get the name from the "User" table that matches this ID to displayed in the combo box? The combo box is already populated with names. ?????

I tried using the RowSource property with a select statement but that only
limited the list to the user name that matched the ID. It did not display
it in the combo box though, you still had to select it. I figured that was because the RowSource property only puts data in the rows and does not do
the displaying of the data.

I do not want to lose the list of users, I just want to display the logged
in one.

I use the ID to filter the records in a list box on the form and other
things.

Thanks.

Dave N


You can do this a few different ways:

#1 - If your combo box Row Source query has both ID and Username (i.e
Select ID, Name From Users) and the ID is hidden, you can simply assign the
User ID to the combo box.

Ex.

Sub Form_OnCurrent( )
Combobox1 = HiddenIDControl
End Sub

#2 - If you ONLY want to show the user who is currently logged on, you can
also alter your rowsource query a little

"Select [ID], [Name] From [UsersTable] Where [ID]=" &
Forms![YourFormName]![YouHiddenContro lName]

Hope that helps...
Nov 12 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
3209
by: mal | last post by:
Sorry for repost - system added to another subject for some reason Have tried numerous ideas from the group to solve this one. It is such a simple example that it should be straightforward ! I just want to add a new item to a combo that has data from a file, by typing in the new value , adding to the file and the requerying to get the new valus in the list. i.e. a data entry and data display combo box. I select an item from cmb1 and...
6
3766
by: Ron L | last post by:
I have a dataset whose source is a SQL 2k stored procedure that I am trying to display in a datagrid. This datasource has 4 columns that I am interested in here, a text column and 3 value columns corresponding to permissions to certain data classes. I want to put the permission values in combo boxes in the grid and instead of displaying the numeric values, have the combo box display a string that corresponds to the numeric value (i.e. No...
10
1912
by: Richard | last post by:
I have created a form which sets up a dataview. The form views one record at a time using a currencymanager. This works fine. All my text boxes bind. However I have a combo box which gets its lookup values from another (Advertising) table (AdvertisingID, Advertising). This works .. However, where it doesn't work as well is when the form loads, the combo boxes should bind to the AdvertisingID field and display the respective data.
4
1587
by: Kay | last post by:
Hi all, Wondering is there a way to work with .net's combo box like in VB 6's with the ItemData property? Coz I want to store 2 values for each item in the combo.... Thanks! Kay
10
7251
by: thh108688 | last post by:
Hi all, I have got a question here perhaps someone can provide me some good information or suggestion. In the Access Form I have created 2 combo box one is Activity combo box, the other is Condition combo box. When i select on Activity combo box value, my Condition combo box will display all the descriptions of the Condition corresponding to the Activity i have selected. ( this is what i wish to get) The problem i have encountered is...
1
4662
by: Kingkev83 | last post by:
I have a problem, i use a combo box to display members details in the following format display member: (concatinated field) Surname &' '& Forename &' '& MembershipNo & - & DateofBirth as `Memberdetails` Valuemember : MembershipNo I would like to sort the combo box by surname/MemberDetails but it currently only sorts by membershipNo. I have tried the sorted = true value which does sort by surname but does not sort the Valuemember:...
1
2580
by: =?Utf-8?B?bWZt?= | last post by:
I have recently migrated to VS.Net 2005, and I am struggling to do something very basic with the combo box. I want to manually loop through a data table and add both the display text and the value manually. The reason I cannot bind the combo box to my data table is that there are more than one field that I want to combine to be the display member. So what I had to do was create yet another data table at run time (or an array list) and...
2
7049
by: biganthony via AccessMonster.com | last post by:
Hi, I decided to install Office 2003 Service Pack 3 on my home computer to test (in full knowledge that there may be some issues with it). After installation, I have noticed that with a small database I wrote for home, the combo boxes and listboxes no longer display the bound column. For example, on a form I have a combo box based on a table called 'names'. The two columns in the combo box are ID and Surname. The combo box and list box...
0
9589
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9423
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10211
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
9994
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
7408
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5298
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3958
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3561
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2815
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.