Cbo box defualt value

LB79

Registered User.
Local time
Today, 02:17
Joined
Oct 26, 2007
Messages
505
Hi All,

I have a cbo box with user names in. It has 2 columns (showing actual name and user name), and I have included an “All” option (its based on a union query). The “All” option returns the value “*”.
When a user opens the database, the cbo box defaults to their name. Bu I want to amend the default so that any user who is not registered will receive the “All” option rather than a blank.
I've been looking at the below but seem to be getting it wrong. Can any one advise?

Thanks

Code:
[COLOR=#1f497d][FONT=Arial]=IIf(NZ(DLookUp("UserID","tbl_REF_RMOPIC INNER JOIN tbl_REF_UID ON tbl_REF_RMOPIC.[PIC Name] = tbl_REF_UID.Name","UserID=" & User())),"*",DLookUp("UserID","tbl_REF_RMOPIC INNER JOIN tbl_REF_UID ON tbl_REF_RMOPIC.[PIC Name] = tbl_REF_UID.Name","UserID=" & User()))[/FONT][/COLOR]
 
Well, first off, your DLookup syntax is way off. You don't reference two tables with a join in it. You need to either reference a single table or a saved query. So, I'm not sure what fields are in which table, so I'll give you a generic reference (and the NZ function can return the value if there isn't a value returned by the DLookup):

=Nz(DLookup("UserID", "YourTableWhereUserIDIsTheField", "UserName=" & Chr(34) & Me.UserName & Chr(34)), "*")
 

Users who are viewing this thread

Back
Top Bottom