473,485 Members | 1,393 Online
Bytes | Software Development & Data Engineering Community
Create 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 2989
"Dave N" <ne*********@johndeere.com> wrote in message
news:3f********@news1.dpn.deere.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*********@johndeere.com> wrote in message
news:3f********@news1.dpn.deere.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]![YouHiddenControlName]

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
3186
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...
6
3739
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...
10
1886
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...
4
1568
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
7211
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...
1
4643
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...
1
2565
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...
2
7012
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...
0
7090
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,...
0
6960
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...
1
6825
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...
0
5418
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
4857
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...
0
3058
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...
0
3063
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1376
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 ...
1
595
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.