Login Interactive form

colkas

Registered User.
Local time
Today, 01:27
Joined
Apr 12, 2011
Messages
128
Hi

I have tried this many times but still having problems. I basically want a user log in screen but then want to be able to oput the user name and job position onto a report front page. Several have tried to help me so my apologies if I seem to be going round in circles.

I have used this link this morning

http://www.about-access-databases.com/dialog-box-form.html

and I created a login screen and it works, apart from I cannot see who is logged in. I am using Access 2010.

I am not up on coding so really need a simple way to;

See the user details and apply them to a quotation report

Any advice please

Thanks
 
How about this...
Assuming your main form has a textbox: txt_UserName
Add textbox control to form you are opening the report from.
txt_CurrentUserName

In the OnClick event of the button that is verifying the credentials...
..if verified,

DoCmd.OpenForm ("YourForm_MainMenu"), acNormal
Forms![YourForm_MainMenu].txt_CurrentUserName = Me.txt_UserName
Then simply point the control on the report to it.
set the control datasource to =Forms![YourForm_MainMenu].txt_CurrentUserName
hth,
..bob
 
Hi Bob

the form for login is purely as a drop down login and then verifys password, it is called frm_login. It as a table attached called tbl_users and in there we have the username, full name, job position etc......

I am using a form called formquote to make the quoatations and it is from here I use button that creates the report. the report as many sub reports, but for the user part it is the front cover, so the form does not have any lionk to the username table.

I dont quite follow what you are mentioning, is it possible, and I dont know much about coding, if you could give me a step by step example, or I am happy to supply the DB, there is no important data in yet.

Many Thanks
 
Hi

Sorry but is there anyway you (or anyone) could help me with this. I have tried all sorts but seem to be getting into a further mess as I go along....

Thanks
 
>>, or I am happy to supply the DB, there is no important data in yet.
Please send the db.
thanks,
..bob
 
Hi bob

Unfortunately I wont be able to get the database till Tuesday/Wednesday next week. I dont suppose you ahve an example we can work with in some way, or using the link one above.

Thanks
 
Hi colkas.
The easiest way I can explain it is to simply create a text box on your report.
Then, in the control source for that text box, simply point at whatever you want to be displayed in that text box.
An example I can give is .. I have an application that has a report where I want to display the description of what I am currently working on in the report. I simply have a textbox (on the report ) that points at the textbox (on my form) that references the current project. So in the REPORT Text Box, the control source is... =[Forms]![frmCodeMain]![frmCodeBrowser].[Form]![Description]
hth,
bob
 
Hi Bob

Please find attached the db. The main tables and forms are

tbl_users and the login form is called frm_login

In the FormQuote I would like to see the login Fullname and Position on the screen

In the report Quotecom, I would like to see the Fullname and Position shown on the from cover.

In the mean time I will look at your explanation above and try and adapt.
 

Attachments

Colkas,
Please view the updated .mdb.
I am not going to do ALL the work for you :)
I did the first one to show you how it works and you should be able
to follow that to complete the rest.
>>In the FormQuote I would like to see the login Fullname and Position on the screen
-- I simply showed you how to get the name to the Form: FormQuote.
You should be able to go from there....

I left the text box visible on the
Main form but you could very well make that not visible.
hth,
..bob
 

Attachments

Hi Bob

Ok I can see the name on the Menu form and also the quote screen, but I dont understand where it is getting the data into it from, please explain.

Also I noticed if I close the quote form or Menu it loses the currentuser name, so I ahve to keep logging in (is this right).

Of course I dont expect it all doing, I enjoy learning and you can only do that by having a go at it.

Thanks
 
>>Ok I can see the name on the Menu form and also the quote screen, but I dont understand where it is getting the data into it from, please explain.
--go to design view on the login form. check the button OK OnClick Event.
this sends it to the main form. When you go to the Quote Form, the button QUOTE button sends it from the main to the quote form.

>>>Also I noticed if I close the quote form or Menu it loses the currentuser name, so I ahve to keep logging in (is this right).
--- No, when you reopen the Menu, simply send the name from whatever form you are on back to the Menu... Persist that through all of your forms. the other option is to have a hidden form that has the username and any other info that you want to reference.


>>>Of course I dont expect it all doing, I enjoy learning and you can only do that by having a go at it.
--- I know.. I know... just playing around :)

hth,
..bob
 
Hi

Now I see the line in the code. If I use Close button on Quote or Print then I assume this code goes on the Click code there. My only worry with this is that a user may close it another way, but getting closer to them using it I suppose we can hide all other buttons to close, but the close one.

Typically I have a couple of questions

1. How do I make this invisble
2. Do I use the same process to get the name onto the front of the report.
3. I dont quite understand what you mean by an invisble form
4. Is there anyway I can log in the quote table the username so when a user enters the quote it records who did it.

1 and 2 are more important.

I will go and play with the names now.

Thanks for the really good help
 
1. How do I make this invisble
Let's say you have a form named ReferenceForm. And on that form you have text boxes that get filled the same way as you filled form MAIN.
to open and hide the form... use... DoCmd.OpenForm ("ReferenceForm"), acNormal, , , , acHidden

2. Do I use the same process to get the name onto the front of the report.
From the report, in the control source... use =Forms![ReferenceForm].form.YourTxtBox

3. I dont quite understand what you mean by an invisble form
--same as question 1

4. Is there anyway I can log in the quote table the username so when a user enters the quote it records who did it.
--sure...
When you create the quote, include the name as part of the insert...
if, your form is bound to the table... then in the BeforeInsert event,
put something like... UserName = me.txtUserName
 
Hi Bob

I am plaing with the code and I am trying to get it to put the full name and position of the user. I have this which works

Forms![main].Form.txtCurrentUser = Me.cbo_user.Column(5) & Me.cbo_user.Column(3)

But I cant get a space in between the user name and the position. tried , " and all sorts. Any ideas.
Also when I add them to the report I would prefer it to appear in wo seprate lines so
instead of
Colin Preston IT

It would be

Colin Preston

IT

Any ideas how to achieve this.

I have questions about invisibility, but I get this first bit solved first.

Many thanks
 
To add a space between 2 variables:

MyVar = String1 & " " & String2

so

Forms![main].Form.txtCurrentUser = Me.cbo_user.Column(5) & " " & Me.cbo_user.Column(3)

JR
 
>>>But I cant get a space in between the user name and the position. tried , " and all sorts. Any ideas.
For the space.... try....
Try...Forms![main].Form.txtCurrentUser = rtrim(Me.cbo_user.Column(5)) & " " & rtrim(Me.cbo_user.Column(3))


>>It would be
Colin Preston
IT
--- txtbox1 = Me.cbo_user.Column(5)
txtbox2 = Me.cbo_user.Column(3)
 
Hi

Thanks guys perfect, I have that working well now.

Next about invisibilty, if I dont want the txt boxes showing on the menu and quote screens etc.... (need it on the report of course), is there away for it just to hide this particular field. I know you mentioned Invisible forms bob but i dont understand that, so is it possible just to make the field invisible.

Thanks alot
 
Hi Bob

Simple for the inivisble field, thanks...

For the report to get this

txtbox1 = Me.cbo_user.Column(5)
txtbox2 = Me.cbo_user.Column(3)

Do i put this in the On Click on the forms or on the control source txtboxes in the report. I tried this in the control source but get #name

=[Forms]![formquote].[Form].[txtcurrentuser]=[me].[cbo_user].[column5]

Any ideas

Thanks
 
Hi Bob

Its ok on the last post, I managed to work it out and used 2 txt boxes and referrred to them in onclick as two lines and same on the report front page..... I am learning slowly ha ha

Now to the last phase number 4.... The quote uses tablequote for record source and the reports use a qry. I assume it is the table you are referring to as this is where I need the data stored. I dont understand what you mean beforeinsert (is it the forms event?), I simply add the data and then click save which works, but not sure how to get the username in..... i obvioulsy need a field in the tablequote called createdby for example... could you explain a little more on how to acheive it...

In the tablequote I ahve added a field called createdby and then tried severl ways to enter things into beforeinsert but it keeps giving error messages the last attmpt was this createdby = formquote.txtcurrentuser

Please help and thanks as always

4. Is there anyway I can log in the quote table the username so when a user enters the quote it records who did it.
--sure...
When you create the quote, include the name as part of the insert...
if, your form is bound to the table... then in the BeforeInsert event,
put something like... UserName = me.txtUserName
 

Users who are viewing this thread

Back
Top Bottom