Forms :: Extract First Name From Username For Welcome Screen?
Apr 9, 2014
I have a module that pulls the user name in the firstname.lastname format. This is the module (module name is fosUserName):
Code:
Public Function GetUser() As String
Dim WNet As Object
Set WNet = CreateObject("WScript.Network")
GetUser = WNet.UserName
End Function
I what to add a a text box on the welcome screen that says something along the lines of Welcome firstname (from the firstname.lastname that the code above pulls) what would you like to do? I need some code that will get me all the characters left of the period that separates the firstname from the lastname.
I have an error message or debug message in my code in username & password log in.. it has an error in if else statement
empname is a cobobox empass is a txtbox logempID is a autonum I.D usrnmpass is a table name
there's an specific record in a table of usrnmpass showing in the attachment
this is my code....
Private Sub Command1_Click() If IsNull(empname) Or empname = "" Then MsgBox "You must enter a User Name.", vbOKOnly, "Required Data" empname.SetFocus Exit Sub End If
My problem is related to an Access database, where an auto complete Combo box is used to select a client record by entering the ID number or the clients name. EG: 14034 or Bloggs,Fred. This problem has me puzzled (not difficult to do).I have seen this in a functioning DB. I can see that maybe the ID (a long integer) would have to be stored or converted to a string on the fly.
I am currently using Access 2007 but 2010 and 2013 are available (prefer 2007 as MS keep moving things around ).I am currently selecting a client record using either an ID select Combo or a ClientName Combo and works very well. But, after seeing it done in one Combo box, it just seems so elegant.
I am having a difficult time figuring out how to have a table add a new record that includes the Windows username of the user that clicks the button on my form. The function is in place that pulls the Windows username:
Code: Public Function getWinUser() As String getWinUser = Environ("UserName") End Function
I then call the function during the button click by simply adding getWinUser. Unfortunately, all that occurs is that the same record gets updated instead of creating a new record.
I have tried to make a login screen, I have also searched for information and tried some of the examples but, I just can't get one to work. Is there someone or somewhere where I can get information on how to build one step by step in simple easy instructions....(access 2003).
Also, how do you get access to open all the windows, tables, queries etc in full screen mode. I have expaneded them and shut it down and then reopened it but they still want to open out of full screen mode.
Thanks, everyone has been a great help in creating my first Access program.
I have a modal, pop-up Form, that I'm using as a dialog box. But, when it opens, I want it positioned on screen in a certain place, but I'm struggling to work out how to do this. What properties do I need to alter/set, to achieve this?
ContextObject .FileName = strPrefix & .StockNumber If .Dirty Then .Dirty = False End If ' .Refresh End With
Stepping through with the debugger, the ".Dirty=False" statement is executed, but the screen does not refresh. If I comment out the "If .Dirty ..." block and comment in the ".Refresh", then the screen does refresh with the new value - but of course that needlessly refreshes all the other records on the form.
The access form froze and they could do other things but Access remained frozen. They logged off and when they went back in Access opened but none of the form buttons or links were working.
The database is not split because it is used only by one station at a time.
Has this happened to anyone and does anyone know the cause?
Five people were trying to fix it when I walked into work (5 people who no nothing about Access other than using that one database) and I couldn't get a straight answer.
I have a screen with multiple records from a database. At the top of the screen I have a button that lets the user change the mode between read only and edit modes. The current mode is displayed near the button. When the user decides to update a record or records he goes into the edit mode and starts changing the records. The user may change any number of records on the screen. When editing is finished he presses a button called save and close gets feedback and leaves the screen. Now in this process how do I keep track of the records that are changed on the screen . Plus he can hit the page down key and go to the next page and make changes there also. Is it possible to stop the hitting of the page down key. What indicators can I use to spot the records changed?
Is there a place I can insert a snippet of code to have all the forms come up full screen. Some users think it is annoying that they dont always come up maximized. Any help would be greatly appreciated!
I have a query screen which worked. It has a header and some details. Now only the header shows up. No detail is visible. I look at the design all these fields are visible, but in reality they are not.
See my 2 attachments. I put the Pop-Up property on the form. that worked but still not what I want.
On the HATT attachment do you see how it opens in the middle of the screen? And the other opens at the top right, (and has that tab at the top right that says frmMain)?
how do i made the airwatch open in the middle? like the other screenshot?
I have on very large form in my db that takes several seconds to load. I want to optimize things, so I am trying to have it load hidden in the background when the db first starts up, this way it can be immediately called on when it is needed later. Please read further :
I want to have a splash screen that loads as well. I have set the splash screen to the default form when the database opens. However, I am not quite sure how to get the other form to load in the background as hidden, AFTER the splash screen opens and appears. I tried calling it with the oncurrent event of the splash screen, but then splash screen wont appear until after the other (hidden) form has finished loading. I have tried different orders of events, but am having no luck getting the desired results.
Summary: I want the splash screen to show first, then the big form to open (hidden) in the background. The user can click on a continue button on the splash screen and then the main switchboard will open.
I need to create a message box or a form or something to flash on the screen to tell the user that a piece of "Update" code is running. the update code will be updated reports from marketing returns, but the 3 branches who use the information are separate so I am creating an update form to download and update the table.
The code for the update is already working, but can take a while, so I thought a message or splash screen would be useful as the update runs on start up.
It would have another use, I have a report which is made mainly of calculated fields on an onPrint event and also takes a while to work it out, so a similar screen would be more useful than my current spinning circle and blank screen.
I have this splash screen, which welcomes all the users. It has an OK command button that exits the screen, and a checkbox that says "Do not show this screen again". I still do not have the code behind the checkbox. Thus I was wondering if there is a way where I could entirelly close or "get rid" of the splash screen until the user loggs in again. Because right now there is no code behind it, so everybody that checks it and click OK, leaves the screen. But they can still open it, if they select the "splash form".
I have the security set via the Access workgroups for both groups and users. I want to be able to use the username entered on the logon screen to filter my query results.
How can I get the logon id that was entered when my switchboard form opens?
I have entered the following code to an onclick button. I am sure I have written it incorrectly (it's probably the line I highlighted below to do with username=Manager. By the way Manager is one of my usernames I have created.
Thanks for your help.
Rob
Private Sub Label218_Click() If UserName = Manager Then DoCmd.OpenReport "Tennis Teams", acNormal Exit Sub End If MsgBox "You do not have permission to open this form!", vbOK, "Tennis Center Business Manager 2007" End Sub
I need the dB to automatically pick up the username of the user logged on to the PC. Thus if I'm logged on to the PC as FLESTER, this username wil populate a database field.
How do you get Access to pick up th OS username currently logged in to the database? For example I'm logged on to the PC as FLESTER and I wnat that recorded in the dB.
A couple of questions. I want my database to query the AD and make sure that the user trying to open the database had an account in the AD. I dont want them prompted for a password though. I have had a look at trying to change the example NT logon in the samples area, but just managed to get myself in a bit of a mess. Also is there anyway that you can query the users full name in AD and call that variable,or does this only work with the username?
Also, when a user created a record in a from, I would like the users username, called from the AD saved in a field in the table. I have tried this and the only way that I can call the variable is by having the "=Environ("USERNAME")" in the control source of the text box. Which means that it cant be save in a field in the table. I have also tried an after updated event on that textbox to update another textbox and have that textbox control source a field on the table. But again this doesn't work. Can someone tell me if what I am trying to do is possible. Thanks