By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,285 Members | 1,691 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,285 IT Pros & Developers. It's quick & easy.

Set Combo default by User

P: n/a
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
Share this Question
Share on Google+
2 Replies


P: n/a
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

P: n/a
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 discussion thread is closed

Replies have been disabled for this discussion.