Full Version: Microsoft Access Form
UtterAccess Forums > Microsoft® Access > Access Forms
wazdaman
hiya guys,
I have designed a database and i want to add some final touches to it but i do not knw how to. first of all on my welcome screen i want it to display the username which you have just loogged on as INTO the database via a login screen (not system login) i have got a code for this but it displays the name which you have logged in to your system with which is not what i want.
secondly i want to make my forms edges rounded but i do not knw how to i have found a code on vbcode.com but it does not wor for some reason.
could someone help me plzzzzz
thanx
Alan_G
Hi
irstly - Welcome to UA frown.gif
Secondly - This is the second time you've posted this same question. Posting more than once doesn't increase your chances of receiving a reply and only serves to confuse others who may try to help you. Please only post a question once.......
Now.........
What happens to the user name who's logging into your db. Are you storing it somewhere? How are you capturing it - via a form bound to a table? And what's the code you're using that doesn't 'work' and where are you getting errors (if any).
You need to provide a bit information..........
HTH
Alan
wazdaman
hey yes th username is coming from a table and the code which i am using is lsited on a website. this does give instructions on what to and the code does work but i want it to take the username out of a table which is linked to a login form where the user logs in.
http://www.databasedev.co.uk/network_user.html
thanks
wazdaman
will anyone help me!!!!!!!!!!!!!!!
adam
hi gain
wazdaman
hey adam could you help me with my problems?
ScottGem
Put an unbound text box on your welcome screen with a datasource of:
fOSUsername()
This will display their network login ID. You can also useL
=Environ("Username")
If you want to display their actual name you need to have it in your table. You would then use:
=DLookup("[Username]","tblUsers","[LoginID] = '" & fOSUsername() & "'")
wazdaman
Hey ScottGem,
hanx for your help but as i am not really familiar with access i don't know how to put that code in the last one which you have written in your previous post.
could you give me step by step instructions on how to do it,
thanx
ScottGem
I told you where to put it; as DATASOURCE of a control.
wazdaman
safe but i am a gcse student and this is ithe first time i am using access so sorry, but anyway ill try to do it but if i can't then will u give me step by step instructions
hanx
tpd15
Hi Scott,
Sorry for barging in, but I have a quick question. I've been using an API just like the one above (which I think may be originally from the mvps website). I think mine is from Candace Tripp (?). Anyway, I noticed that you also posted:
=Environ("Username")
I'd like to know if that is some independent global variable or whatever. I've made a fresh dbase & a single form with =Environ("Username") as the default value of a textbox, and it does display the Windows login name. Is there any situation where Environ("Username") fails? That is, do I need to use that API or can I just use =Environ("Username") without an added API?
ScottGem
Step by Step:
-Open form in design mode
2-Select control
3-Right click on control and select properties
4-Open Data tab
5-Type expression into Datasource property
ScottGem
The Environ() function returns several pieces of info about the windows environment. See this post.
Jack Cowley
In Scott's step by step replace 'Datasource' with Control Souce as that is the actual name of the propery you want to put your code in.
th,
Jack
tpd15
Scott,
Thanks for the link. Lots of info to get out of the app!
Do you (or anyone else) have an opinion on using Environ() vs. the API?
wazdaman
hi scott,
I have put that
DLookup("[Username]","tblUsers","[LoginID] = '" & fOSUsername() & "'")
in a control source of a unbound text box
I have changed the code thingy so it suits me by putting my own tables name but it still doesnt work
do u knw wots rong....
ScottGem
its got to be =Dlookup and yes you need to use your own field and table names.
.S. thanks to jack for catching the control vs data source goof. I always mix those two up.
wazdaman
thanx i have started to build my own expression now and i have got to a bit were i dont knw wot else to rite
DLookUp([tblEmployees]![strEmpName],[«domain»],[«criteria»])
[«domain»],[«criteria»]) what do i have to type in ere
tpd15
Not wanting to step on Scott's toes, but I've attached a jpg of what (I think) he's meaning. See attachment.
Make sure you have the = sign at the start of the expression. I've found you can also paste the code into the "Default Value" property instead of "Control Source" and it works just as well. (But there's probably a good reason why it should be Control Source).
wazdaman
thanx m8
can see kn but what code or expression ave u put in the username textbox could u get me a print screen of that aswell
sorry to be so fussy but im not good with this stuff and ive only just found out about expresion building just today
thanx
wazdaman
this is gettin on ma nerves,
hey m8 could you just send me an access attachment of how its done
If u can
thanx i would so appreciate it
waz
tpd15
I have different field & table names from what Scott uses, you'll have to susbstitute your own. DLookup compares the current UserName (FOSUsername) & fetches the corresponding FullName from my lkptbl_UserName.

Best thing to do is read Access's Help on DLookup, that'll see you right.

See attachment. Scott, let me know if I'm getting in way.
Edited by: tpd15 on Wed Dec 14 16:36:47 EST 2005.
Jack Cowley
Scott -
You know that I read every one of your post just HOPING to catch you in an error...NOT!
Jack
wazdaman
thanx for this
That does the [fullname] stand for do i have to change this to what ever field has the usernames in it
wazdaman
by the way in my table i dont have a fiield called full name all i have is a 'strusername' field
tpd15
"fullname" is the field in my table where I store the person's literal name, as opposed to their login name.
edit> look at the table in the dbase I sent.
Edited by: tpd15 on Wed Dec 14 16:58:00 EST 2005.
wazdaman
ok thanx
knw wot i will send u the first part of my database where i need the dlookup on the wlcome screen as an attachment the password for "Wasil Ahmed" is "password" which you will need if you want to access it ok will you be able to do this look up thing and then email the thing back to me as an attachment
thanks
waz
by da way i dont knw how to send an attachment via this thing?????????
tpd15
If you're going to post a copy of your dbase, you have to zip it and attached it to a post.
It the bottom of the post writing window, have the "Preview my post and/or attach a file" checked. Then hit Continune, and before you Submit, you're given the ability to attached a file. (It can't be over 0.5 Mb I think).
I'm just leaving to go home for the day, so hopefully someone else can jump in or you can wait a day...
wazdaman
ok thanx
knw wot i will send u the first part of my database where i need the dlookup on the wlcome screen as an attachment the password for "Wasil Ahmed" is "password" which you will need if you want to access it ok will you be able to do this look up thing and then email the thing back to me as an attachment
thanks
waz
wazdaman
will someone please do the lookup on the attachment which i have previously sent and then send it back to me once it is working
Jack Cowley
I used a global variable to capture the name from the Login form and then code in the On Open event to put the name on your form. Just another way to skin the Access cat...
th,
Jack
Jack Cowley
You DLookup is not going to work because there is nothing to use as the criteria for the function. Your table has their name, password and their access, but nothing, other than the password, that is unique... If your table had their ID then you would have something to look up, but your login form has the data you want so why not use it?
If you want to learn how to use DLookup() then this article will help.
Jack
ScottGem
Lookup DLookup in Access help. It explains it. The first part is the fieldname, then domain is the tablename and the criteria is the record you want to lookup. You also have to use the quotes like I did.
ScottGem
The problem here is you don't have the network loginID in your table. The fOSUsername() function returns the users current network login. But since its not in the table its not going to work.
lso I would not use a single field for people's names.
What I would do is first add a field named NetworkID and add their network login to that field. Next separate out the employee names into fields named First and Last (I don't go along with using naming conventions for field names). Next I would create a query named qryEmpFullName that would look like this:
SELECT NetworkID, [First] & " " & [Last] AS Fullname FROM qryEmpFullName ORDER BY Last, First;
Finally, your DLookup will look like this:
=DLookup("[Fullname]","qryEmpFullName","[NetworkID] = '" & fOusUsername() & "'")
If you follow these instructions exactly it should work.
wazdaman
thanx mate but the thing is it dont make no sense to me so just to save everyone the hassle can't you do it on the attachment which i will send with this message and then it willl make sense to me of what u are on about andi have read the dlookup the first few bits make sense but then the criteria confuses me
hanx
wazdaman
the database attachment is here feel free to change fields if neccassary...
wazdaman
Thanks mate i didnt realise that you had done it for me and sent the attachment and thanks to all those that also helped me scott, jack and toby i really appreciate your help and by the way is it possible for making form edges curved.???
Aquadevel
Waz,
If you search for "Security2000" on this site it will do what you want with little modification.
I'm not knocking Scott's nor anyone else's info, just adding my 2 1/2 cents worth. frown.gif
good luck,
Aqua
This is a "lo-fi" version of UA. To view the full version with more information, formatting and images, please click here.