473,405 Members | 2,379 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

Set Combo default by User

I have a multiuser database which VBA to return the current users NT
logon. The database has a table which contains the names of all users
and a field called bmlogon which holds their NT logon. The database
is used to track admin tasks. to add a new task the user first
selects the type and then clicks a command button to go to the form
for entering the details. The on current property of the main form
(for entering details) takes the type from the previous form and
updates a field. Part of the dataentry involves the user selecting
their name from a combo box.

Rather than selecting their name I was hoping that I could
programatically set the combobox based on a match between NTlogon from
the module and Nt logon from the table. I have made various attempts
starting with : -

Me.cmbrelmanid.DefaultValue = Nz(DLookup("relmanname", "tblrelman",
"[relmanlogon] = " & Chr$(34) & Me.[User1] & Chr$(34))) where
Me.User1 pulls the logon

' Me![cmbrelmanid].[Column](1) = DLookup("[relmanname]",
"tblrelman", "[relmanlogon] ='" & NTUser() & "'") where NTuser is the
coding that grabs the NT logon.

I have also tried placing the dlookup sections in default value.

I kept getting a 64479 error until I put the single quotes in but then
get an undocumented error 2147352562.

Anyone see where I am going wrong
Nov 12 '05 #1
2 1841
If you are trying to set the value of the combobox, then just use
Me!cmbrelmanid = value

Where value is whatever method (query, variable or otherwise) you use to
get the NT logon.
In the two examples you've supplied, you have so far tried to set the
default value property, and tried to change the value in the 2nd column
of the combo. The default value is only what the control will equal when
the form opens, or a record pointer moves to a new record.

Mike Storr
www.veraccess.com
David Mitchell wrote:
I have a multiuser database which VBA to return the current users NT
logon. The database has a table which contains the names of all users
and a field called bmlogon which holds their NT logon. The database
is used to track admin tasks. to add a new task the user first
selects the type and then clicks a command button to go to the form
for entering the details. The on current property of the main form
(for entering details) takes the type from the previous form and
updates a field. Part of the dataentry involves the user selecting
their name from a combo box.

Rather than selecting their name I was hoping that I could
programatically set the combobox based on a match between NTlogon from
the module and Nt logon from the table. I have made various attempts
starting with : -

Me.cmbrelmanid.DefaultValue = Nz(DLookup("relmanname", "tblrelman",
"[relmanlogon] = " & Chr$(34) & Me.[User1] & Chr$(34))) where
Me.User1 pulls the logon

' Me![cmbrelmanid].[Column](1) = DLookup("[relmanname]",
"tblrelman", "[relmanlogon] ='" & NTUser() & "'") where NTuser is the
coding that grabs the NT logon.

I have also tried placing the dlookup sections in default value.

I kept getting a 64479 error until I put the single quotes in but then
get an undocumented error 2147352562.

Anyone see where I am going wrong

Nov 12 '05 #2
Mike Storr <no****@noname.con> wrote in message news:<RV*********************@news20.bellglobal.co m>...
If you are trying to set the value of the combobox, then just use
Me!cmbrelmanid = value


Thanks for that Mike, didn't realise that I had bound the combo to id
number and not name, when I changed this and used your suggestion it
worked perfectly.
Nov 12 '05 #3

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

Similar topics

2
by: Dave N | last post by:
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...
2
by: Todd D. Levy | last post by:
I have a table of Country names & Country codes in alphabetical order. This is a lookup table that a number of other tables use to populate the Country field via a drop down Combo Box on the...
2
by: Sean | last post by:
Greetings all, I am attempting to make a form that will filter through several tables that (I believe) have refretial integrity. I am pulling data from several tables into the form and i would...
8
by: Lyn | last post by:
Hi, Can anyone tell me how the initial value displayed in Combo Box is determined when a form is opened? I am loading the dropdown from one field ("CategoryName") of a table, with "ORDER BY ". ...
3
by: Torilyn73 | last post by:
I posted this earlier... or thought I did... anyway.. it's doesn't appear in the list so I'm reposting it. Can someone please explain to me how to set up the lostfocus event for a combo box. I...
4
Rabbit
by: Rabbit | last post by:
Cascading Combo/List Boxes This tutorial is to guide you in the creation of Cascading combo/list boxes. That is when you have multiple combo/list boxes where the selection of an option in one...
13
by: mirandacascade | last post by:
I want to set things up such that a section of code will have been executed by the time one clicks on the drop down arrow on a combo box control. Currently, that section of code resides in the...
2
kmartinenko
by: kmartinenko | last post by:
Hi everyone, I have several combo boxes on my form, and while I have designated a column head, I cannot figure out how to default to the column head value. What I really want is for all of my...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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
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
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,...
0
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...

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.