473,480 Members | 2,271 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

login / username

48 New Member
hi.... i am used a tutorial found at...http://www.databasedev.co.uk/login.html... to create a login form. works fine, what i am wanting to do is on one of my forms, where data is entered i use the following code..
Expand|Select|Wrap|Line Numbers
  1. Private Sub InputData_Click()
  2.    If InputData.Caption = "Input New Notes" Then
  3.    NotesMemoField.Visible = True
  4.    NotesMemoField.SetFocus
  5.    InputData.Caption = "Add Data"
  6. Else
  7.   If Len(NotesMemoField.Value) > 0 Then
  8.     DoCmd.SetWarnings False
  9.     NotesMemoField.SetFocus
  10.     NotesMemoField.SelStart = 1
  11.     NotesMemoField.SelLength = Len(NotesMemoField.Value)
  12.     DoCmd.RunCommand acCmdSpelling
  13.     NotesMemoField.SelLength = 0
  14.     DoCmd.SetWarnings True
  15.       Forms!Issues![TabControl].Pages("Comments").SetFocus
  16.       Me.Comment = Me.Comment & " " & vbNewLine & Now & ": " & Me.NotesMemoField & vbNewLine
  17.   End If
  18.    InputData.Caption = "Input New Notes"
  19.    Me.NotesMemoField = ""
  20.    NotesMemoField.Visible = False
  21. End If
  22. End Sub
  23.  
to move the data entered to another memo box on the form where the data is appended to. as you can see it date/time stamps the data entered as it moves it across.
is there anyway of altering either/both code so after the date/time stamp it also stamps the name of the person that logged on the database from the login form from the tutorial???
cheers
Feb 29 '08 #1
25 2402
Stewart Ross
2,545 Recognized Expert Moderator Specialist
Hi Dale. You can use a global variable to store the username, updated in the AfterUpdate event of the employee entry combo in your login code, and a public function to return the value of the username global variable.

In the code module of your login code add the following public (global) variable definition and function:
Expand|Select|Wrap|Line Numbers
  1. 'global to store current user name
  2. Public UserName As String
  3.  
  4. Public Function ReturnUsername()
  5.     ReturnUserName = UserName
  6. End Function
  7.  
Change the AfterUpdate event of the cboEmployee combo in the databasedev code to set the global, as indicated below:
Expand|Select|Wrap|Line Numbers
  1. Private Sub cboEmployee_AfterUpdate()
  2.     UserName = cboEmployee '<<< This line sets the global variable to 
  3.                                                  ' the value in the entry combo
  4.     'After selecting user name set focus to password field
  5.     Me.txtPassword.SetFocus
  6. End Sub
  7.  
You can then add the username function call into your memo timestamp routine if you want, as shown below, although my preference would be to store it in a separate field created for that purpose:
Expand|Select|Wrap|Line Numbers
  1. Me.Comment = Me.Comment & " " & vbNewLine & UserName() & " " & Now & ": " & Me.NotesMemoField & vbNewLine
-Stewart
Mar 2 '08 #2
dale5804
48 New Member
cheers for this, will give it a go today. many thanks
Mar 3 '08 #3
dale5804
48 New Member
hi, tried it, but the code below on the 'on open' is giving me a compile error, a invalid attribute in sub or function, ad is highlighting this bit...

Public UserName As String

any ideas
cheers
Mar 3 '08 #4
Stewart Ross
2,545 Recognized Expert Moderator Specialist
hi, tried it, but the code below on the 'on open' is giving me a compile error, a invalid attribute in sub or function, ad is highlighting this bit...

Public UserName As String

any ideas
cheers
Hi Dale. You need to add the definition at the top of a code module (the declaration section); I wonder if you have accidentally placed it within another procedure in the code module instead? If you are unsure about this, copy the code from the code module and paste it into your next post and I'll check it for you.

It is always worth compiling any code you add before finalising changes (Debug, Compile.. from the editor menu), as the compiler can let you know of these issues before you try out the revised forms...

-Stewart
Mar 3 '08 #5
dale5804
48 New Member
Hi Stewart, thanks for the reply, ive done...
Expand|Select|Wrap|Line Numbers
  1. Private Sub cmdLogin_Click()
  2. Public UserName As String
  3. 'global to store current user name
  4.       Public Function ReturnUsername()
  5.           ReturnUsername = UserName
  6.       End Function
  7.  
  8. 'Check to see if data is entered into the UserName combo box
  9.  
  10.     If IsNull(Me.cboEmployee) Or Me.cboEmployee = "" Then
  11.             MsgBox "You must enter a User Name.", vbOKOnly, "Required Data"
  12.             Me.cboEmployee.SetFocus
  13.         Exit Function
  14.     End If
  15.  
  16. 'Check to see if data is entered into the password box
  17.  
  18.     If IsNull(Me.txtPassword) Or Me.txtPassword = "" Then
  19.             MsgBox "You must enter a Password.", vbOKOnly, "Required Data"
  20.             Me.txtPassword.SetFocus
  21.         Exit Function
  22.     End If
  23.  
  24. 'Check value of password in Contacts  to see if this matches value chosen in combo box
  25.  
  26.     If Me.txtPassword.Value = DLookup("strEmpPassword", "Contacts", "[ID]=" & Me.cboEmployee.Value) Then
  27.  
  28.         lngMyEmpID = Me.cboEmployee.Value
  29.  
  30.  
  31.  
  32. 'Close logon form and open Start
  33.  
  34.         DoCmd.Close acForm, "frmLogon", acSaveNo
  35.         DoCmd.OpenForm "Start"
  36.  
  37.         Else
  38.         MsgBox "Password Invalid.  Please Try Again", vbOKOnly, "Invalid Entry!"
  39.         Me.txtPassword.SetFocus
  40.     End If
  41.  
  42. 'If User Enters incorrect password 3 times database will shutdown
  43.  
  44.     intLogonAttempts = intLogonAttempts + 1
  45.     If intLogonAttempts > 3 Then
  46.         MsgBox "You do not have access to this database.  Please contact your system administrator.", vbCritical, "Restricted Access!"
  47.         Application.Quit
  48.     End If
  49.  
  50.  
  51.  
  52. End Function
  53.  
  54. End Sub
  55.  
Mar 3 '08 #6
Stewart Ross
2,545 Recognized Expert Moderator Specialist
Hi Dale. You have indeed placed the code in the wrong part of your code module; the definition cannot be placed inside the subroutine as you currently have it. I have taken these lines out of the Sub as shown below. As the Sub cmdLogin is but one of the procedures in the login code, I think you are not clear on what a code module is. A code module is a named code sheet within the Visual Basic environment. Each one has a declaration section followed by a code section which includes all function and subroutine definitions.

You MUST place the definition of the UserName variable in the top (declaration) section of a code module - it can't be placed within a function or sub procedure.

I also note that there is an End Function statement at the bottom for which I cannot see a corresponding opening Public Function or Private Function declaration. It may be that you have moved code around and accidentally cut off a function somewhere, but I'm sorry to say I can't debug the exemplar code. I would suggest you check your implementation of the original code from DatabaseDev to see that you have not accidentally overwritten some of the declarations.

-Stewart
Expand|Select|Wrap|Line Numbers
  1. 'global to store current user name 
  2. Public UserName As String '<<< this must be placed in the declaration section of the code module (the very top of the code sheet)
  3.  
  4. Public Function ReturnUsername() '<<< this function can be placed immediately after the declaration section
  5.     ReturnUsername = UserName
  6. End Function
  7.  
  8. Private Sub cmdLogin_Click()
  9.  
  10. 'Check to see if data is entered into the UserName combo box
  11.  
  12. If IsNull(Me.cboEmployee) Or Me.cboEmployee = "" Then
  13. MsgBox "You must enter a User Name.", vbOKOnly, "Required Data"
  14. Me.cboEmployee.SetFocus
  15. Exit Function
  16. End If
  17.  
  18. 'Check to see if data is entered into the password box
  19.  
  20. If IsNull(Me.txtPassword) Or Me.txtPassword = "" Then
  21. MsgBox "You must enter a Password.", vbOKOnly, "Required Data"
  22. Me.txtPassword.SetFocus
  23. Exit Function
  24. End If
  25.  
  26. 'Check value of password in Contacts to see if this matches value chosen in combo box
  27.  
  28. If Me.txtPassword.Value = DLookup("strEmpPassword", "Contacts", "[ID]=" & Me.cboEmployee.Value) Then
  29.  
  30. lngMyEmpID = Me.cboEmployee.Value
  31.  
  32. 'Close logon form and open Start
  33.  
  34. DoCmd.Close acForm, "frmLogon", acSaveNo
  35. DoCmd.OpenForm "Start"
  36.  
  37. Else
  38. MsgBox "Password Invalid. Please Try Again", vbOKOnly, "Invalid Entry!"
  39. Me.txtPassword.SetFocus
  40. End If
  41.  
  42. 'If User Enters incorrect password 3 times database will shutdown
  43.  
  44. intLogonAttempts = intLogonAttempts + 1
  45. If intLogonAttempts > 3 Then
  46. MsgBox "You do not have access to this database. Please contact your system administrator.", vbCritical, "Restricted Access!"
  47. Application.Quit
  48. End If
  49.  
  50. End Function '<<< This appears to be an orphaned End Function statement
  51.  
  52. End Sub
  53.  
[/quote]
Mar 3 '08 #7
dale5804
48 New Member
hi.. thanks for that i understand better now.
now to move onto the code that does the time/users stamping
cheers
Mar 3 '08 #8
dale5804
48 New Member
stuck again. when i click to add data (and stamp) having issue with this line:

Me.Comment = Me.Comment & " " & vbNewLine & UserName() & Now & ": " & Me.NotesMemoField & vbNewLine

getting a compile error, which highlights the the Me.Comment, after the = sign.
It worked before, but once i add the UserName() it does as above.
any ideas. cheers
Mar 3 '08 #9
Stewart Ross
2,545 Recognized Expert Moderator Specialist
stuck again. when i click to add data (and stamp) having issue with this line:

Me.Comment = Me.Comment & " " & vbNewLine & UserName() & Now & ": " & Me.NotesMemoField & vbNewLine

getting a compile error, which highlights the the Me.Comment, after the = sign.
It worked before, but once i add the UserName() it does as above.
any ideas. cheers
Hi Dale. I'm not seeing any obvious error in the line above. have you compiled the code in VB and checked that there are no debug errors introduced elsewhere by the changes (easy to do accidentally when moving code around)? Have you added the line to the cmbEmployee after update event which sets the value of the UserName public variable in the first place? Can you check using the VB code window what the value of the UserName() function is when the error occurs (if you hover your mouse over the function name the VB editor will tell you its value, or you can use the immediate window to 'print' the value by typing ? UserName() followed by Enter.

You could always remove the '& UserName()' part to check that you have not got a typo in your code line - which is actually my first thought about what may be wrong, given the changes you have had to make...

-Stewart
Mar 3 '08 #10
dale5804
48 New Member
You could always remove the '& UserName()' part to check that you have not got a typo in your code line - which is actually my first thought about what may be wrong, given the changes you have had to make...

-Stewart
hi Stewart, ive, tried and removed the & UserName(), and when i do, it works again????


if it helps...
This is the whole login form VB code

Expand|Select|Wrap|Line Numbers
  1. Option Compare Database
  2. Private intLogonAttempts As Integer
  3. Public UserName As String
  4.       Public Function ReturnUsername()
  5.           ReturnUsername = UserName
  6.       End Function
  7.  
  8. Private Sub Form_Open(Cancel As Integer)
  9. 'On open set focus to combo box
  10. Me.cboEmployee.SetFocus
  11. End Sub
  12.  
  13. Private Sub cboEmployee_AfterUpdate()
  14. UserName = cboEmployee
  15.           Me.txtPassword.SetFocus
  16. End Sub
  17.  
  18. Private Sub cmdLogin_Click()
  19.  
  20. 'Check to see if data is entered into the UserName combo box
  21.  
  22.     If IsNull(Me.cboEmployee) Or Me.cboEmployee = "" Then
  23.             MsgBox "You must enter a User Name.", vbOKOnly, "Required Data"
  24.             Me.cboEmployee.SetFocus
  25.         Exit Sub
  26.     End If
  27.  
  28. 'Check to see if data is entered into the password box
  29.  
  30.     If IsNull(Me.txtPassword) Or Me.txtPassword = "" Then
  31.             MsgBox "You must enter a Password.", vbOKOnly, "Required Data"
  32.             Me.txtPassword.SetFocus
  33.         Exit Sub
  34.     End If
  35.  
  36. 'Check value of password in Contacts  to see if this matches value chosen in combo box
  37.  
  38.     If Me.txtPassword.Value = DLookup("strEmpPassword", "Contacts", "[ID]=" & Me.cboEmployee.Value) Then
  39.  
  40.         lngMyEmpID = Me.cboEmployee.Value
  41.  
  42. 'Close logon form and open Start
  43.  
  44.         DoCmd.Close acForm, "frmLogon", acSaveNo
  45.         DoCmd.OpenForm "Start"
  46.  
  47.         Else
  48.         MsgBox "Password Invalid.  Please Try Again", vbOKOnly, "Invalid Entry!"
  49.         Me.txtPassword.SetFocus
  50.     End If
  51.  
  52. 'If User Enters incorrect password 3 times database will shutdown
  53.  
  54.     intLogonAttempts = intLogonAttempts + 1
  55.     If intLogonAttempts > 3 Then
  56.         MsgBox "You do not have access to this database.  Please contact your system administrator.", vbCritical, "Restricted Access!"
  57.         Application.Quit
  58.     End If
  59.  
  60. End Sub
  61.  
and this is the whole vb code of the form which has the date/user stamp part with in it
Expand|Select|Wrap|Line Numbers
  1. Option Compare Database
  2.  
  3.  
  4. Private Sub Command83_Click()
  5. DoCmd.OpenReport "Issue Details", acViewPreview, , _
  6. "[ID]=Issues"
  7. End Sub
  8.  
  9. Private Sub Command85_Click()
  10. strWhere = "[ID] = " & Me.[ID]
  11. DoCmd.OpenReport "Issue Details", acNormal, , strWhere
  12. End Sub
  13.  
  14.  
  15.  
  16. Private Sub DueDate_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
  17. ocxCalendar.Visible = True
  18. ocxCalendar.SetFocus
  19. If Not IsNull(DueDate) Then
  20.    ocxCalendar.Value = DueDate.Value
  21. Else
  22.    ocxCalendar.Value = Date
  23.    End If
  24. End Sub
  25.  
  26. Private Sub Form_BeforeUpdate(Cancel As Integer)
  27. If MsgBox("Changes have been made to this Issue" _
  28.         & vbCrLf & vbCrLf & "Do you want to save these changes?" _
  29.         , vbYesNo, "Message From SCRM...") = vbYes Then
  30.             DoCmd.Save
  31.         Else
  32.             DoCmd.RunCommand acCmdUndo
  33.     End If
  34. End Sub
  35.  
  36. Private Sub Image52_Click()
  37. Dim strInput As String, strMsg As String
  38.  
  39.    strMsg = "Enter your password to proceed."
  40.    strInput = InputBox(Prompt:=strMsg, _
  41.        Title:="SCRM Security Check")
  42.  
  43.    If UCase(strInput) = "people5804" Then
  44.  
  45.         DoCmd.RunCommand acCmdDeleteRecord
  46.    Else
  47.         MsgBox "Sorry wrong password."
  48.    End If
  49. End Sub
  50.  
  51.  
  52. Private Sub InputData_Click()
  53.  If InputData.Caption = "Input New Notes" Then
  54.    NotesMemoField.Visible = True
  55.    NotesMemoField.SetFocus
  56.    InputData.Caption = "Add Data"
  57. Else
  58.   If Len(NotesMemoField.Value) > 0 Then
  59.     DoCmd.SetWarnings False
  60.     NotesMemoField.SetFocus
  61.     NotesMemoField.SelStart = 1
  62.     NotesMemoField.SelLength = Len(NotesMemoField.Value)
  63.     DoCmd.RunCommand acCmdSpelling
  64.     NotesMemoField.SelLength = 0
  65.     DoCmd.SetWarnings True
  66.       Forms!Issues![TabControl].Pages("Comments").SetFocus
  67.       Me.Comment = Me.Comment & " " & vbNewLine & UserName() & Now & ": " & Me.NotesMemoField & vbNewLine
  68.   End If
  69.    InputData.Caption = "Input New Notes"
  70.    Me.NotesMemoField = ""
  71.    NotesMemoField.Visible = False
  72. End If
  73. End Sub
  74.  
  75. Private Sub ocxCalendar_Click()
  76. DueDate.Value = ocxCalendar.Value
  77. DueDate.SetFocus
  78. ocxCalendar.Visible = False
  79. End Sub
  80.  
  81.  
  82. Private Sub Text78_BeforeUpdate(Cancel As Integer)
  83. Dim SID As String
  84.     Dim stLinkCriteria As String
  85.     Dim rsc As DAO.Recordset
  86.  
  87.     Set rsc = Me.RecordsetClone
  88.  
  89.     SID = Me.Text78.Value
  90.     stLinkCriteria = "[Sap Co No]=" & "'" & SID & "'"
  91.  
  92.     'Check issue table for duplicate Sapco
  93.     If DCount("Text78", "Issues", stLinkCriteria) > 0 Then
  94.         'Undo duplicate entry
  95.         Me.Undo
  96.         'Message box warning of duplication
  97.         MsgBox "Warning This SapCo Number " _
  98.              & SID & " has already been entered into SCRM!" _
  99.              & vbCr & vbCr & "You will now been taken to that Issue. You can Edit it from there.", _
  100.                vbInformation, "Duplicate Information"
  101.         'Go to record of original Sapco
  102.         rsc.FindFirst stLinkCriteria
  103.         Me.Bookmark = rsc.Bookmark
  104.     End If
  105.  
  106.     Set rsc = Nothing
  107.  
  108. End Sub
  109.  
  110.  
  111.  

cheers
Mar 3 '08 #11
Stewart Ross
2,545 Recognized Expert Moderator Specialist
Hi Dale. I have inadvertently led you astray - sorry! The function is called ReturnUserName(), not UserName(), which changes the call in your timestampline to
Expand|Select|Wrap|Line Numbers
  1. Me.Comment = Me.Comment & " " & vbNewLine & ReturnUserName() & " " & Now & ": " & Me.NotesMemoField & vbNewLine
Apologies for the overlook

-Stewart
Mar 3 '08 #12
dale5804
48 New Member
Hi Dale. I have inadvertently led you astray - sorry! The function is called ReturnUserName(), not UserName(), which changes the call in your timestampline to
Expand|Select|Wrap|Line Numbers
  1. Me.Comment = Me.Comment & " " & vbNewLine & ReturnUserName() & " " & Now & ": " & Me.NotesMemoField & vbNewLine
Apologies for the overlook

-Stewart

didnt work, have changed to ReturnUsername (capital R & U, small n) and same problem???
Mar 3 '08 #13
Stewart Ross
2,545 Recognized Expert Moderator Specialist
didnt work, have changed to ReturnUsername (capital R & U, small n) and same problem???
Hi Dale. Remove the definition of the ReturnUsername function from the form code module and place it in a public module instead (listed under Modules in the VBE editor window, or in the Module window of the Access database. Create a new module under any suitable name if there is not one already present). I did not know there were two different form code modules involved. The second one does not see the first module's functions, it would appear.

I have tried your memo update procedure and found it working when the definition of function ReturnUsername is in scope with the update routine. If you move the code to a public module this should resolve the problem altogether.

-Stewart
Mar 3 '08 #14
dale5804
48 New Member
Hi Dale. Remove the definition of the ReturnUsername function from the form code module and place it in a public module instead (listed under Modules in the VBE editor window, or in the Module window of the Access database. Create a new module under any suitable name if there is not one already present). I did not know there were two different form code modules involved. The second one does not see the first module's functions, it would appear.

I have tried your memo update procedure and found it working when the definition of function ReturnUsername is in scope with the update routine. If you move the code to a public module this should resolve the problem altogether.

-Stewart
hi...sorry, as you may have guessed, still new at this vb stuff. not quite sure what your telling me to do.
Mar 3 '08 #15
Stewart Ross
2,545 Recognized Expert Moderator Specialist
hi...sorry, as you may have guessed, still new at this vb stuff. not quite sure what your telling me to do.
Hi Dale. Simplest way if you are not sure is to create a new, blank, module (select Modules in the database window, then New). The VB editor will open in a new, blank, module. From the VB editor window go to the form code module in which the ReturnUsername function is currently placed, select the function, then cut that definition from the form's module. Re-select the new, blank, code module and paste the function in there instead. It is so short you could retype it if you have to.

Save all changed modules. Compile the code to ensure there are no accidental errors.

This should resolve the problem you are experiencing, which is because one form's code module cannot see the definition of ReturnUsername in the other.

-Stewart
Mar 3 '08 #16
dale5804
48 New Member
do i need to call the module anything for it to work?
Mar 3 '08 #17
Stewart Ross
2,545 Recognized Expert Moderator Specialist
do i need to call the module anything for it to work?
Any module name will do, Dale. Even t he default of Module1, although I would change it to something such as General Routines.
-Stewart
Mar 3 '08 #18
dale5804
48 New Member
Any module name will do, Dale. Even t he default of Module1, although I would change it to something such as General Routines.
-Stewart
thought so, so i did what u said, and still having the same problem. any other ideas. cheers
Mar 3 '08 #19
Stewart Ross
2,545 Recognized Expert Moderator Specialist
thought so, so i did what u said, and still having the same problem. any other ideas. cheers
No other ideas, sorry. It works in my test system as long as the function is in scope. You must be overlooking something, but I'm afraid at this distance I simply can't think of any relevant explanation. You have declared it as a Public function? Have you tested it in the VB immediate window as I suggested much earlier? You could set break points and step through the code one line at a time, but I think you would not be in a position to benefit from this unless you know what you are looking for. I would recommend you read a good introductory text on VBA programming.

I use system functions to retrieve the username of the currently-logged-in user from the windows API in my own systems without any hitches at all. Although I am not querying a value supplied by the user, the return values are done in a similar way to what you have been advised.

Sorry it has not worked out for you after all the effort you have put in.

-Stewart
Mar 3 '08 #20
dale5804
48 New Member
hi Stewart, thanks for all you help. i will keep trying, but you've been a star. wouldn't have got this far without your advice. cheers
Mar 3 '08 #21
Stewart Ross
2,545 Recognized Expert Moderator Specialist
One final thing: move the global variable Username to your new code module as well. Same issue - the variable needs to be in scope.

-Stewart
Mar 3 '08 #22
Stewart Ross
2,545 Recognized Expert Moderator Specialist
Hi again Dale. One other overlook on my part is that the ReturnUsername function should have been typed as a String. This is what happens when I take a working function of my own and change it to post it.

The global and the function, both now in your public module, should be:
Expand|Select|Wrap|Line Numbers
  1. Public UserName as String 
  2.  
  3. Public Function ReturnUserName () as String
  4.     ReturnUserName = UserName
  5. End Function
  6.  
and final thing to try, because there are no parameters for ReturnUserName remove the brackets in timestamp function call:
Expand|Select|Wrap|Line Numbers
  1. ...vbNewLine & ReturnUserName & ...
So near yet so far...

-Stewart
Mar 4 '08 #23
dale5804
48 New Member
Hi again Dale. One other overlook on my part is that the ReturnUsername function should have been typed as a String. This is what happens when I take a working function of my own and change it to post it.

The global and the function, both now in your public module, should be:
Expand|Select|Wrap|Line Numbers
  1. Public UserName as String 
  2.  
  3. Public Function ReturnUserName () as String
  4.     ReturnUserName = UserName
  5. End Function
  6.  
and final thing to try, because there are no parameters for ReturnUserName remove the brackets in timestamp function call:
Expand|Select|Wrap|Line Numbers
  1. ...vbNewLine & ReturnUserName & ...
So near yet so far...

-Stewart
cheers, getting there, the code doesnt throw an error up, but when the data is transferred, it prints the user as '1' then the time/date stamp?? I've also tried and removed the brackets as you suggested, and i stll get 1 as the username???
Mar 4 '08 #24
Stewart Ross
2,545 Recognized Expert Moderator Specialist
[font=Arial]
cheers, getting there, the code doesnt throw an error up, but when the data is transferred, it prints the user as '1' then the time/date stamp?? I've also tried and removed the brackets as you suggested, and i stll get 1 as the username???
Hi Dale. I did not check what was in the combo box in the DatabaseDev code; it is clearly the employee number which is in the default column. This one is easily fixed.[/font]

[font=Arial]In the cboEmployee after update, change the code as follows:
Expand|Select|Wrap|Line Numbers
  1. Private Sub cboEmployee_AfterUpdate()
  2.     UserName = cboEmployee.column(1) '<<< This line sets the global variable to 
  3.                                                  ' the value in the entry combo
  4.     'After selecting user name set focus to password field
  5.     Me.txtPassword.SetFocus
  6. End Sub
This will refer to the name in the second column of the combo box (referred to as column(1) because the numbering is from 0).
-Stewart
[/font]
Mar 4 '08 #25
dale5804
48 New Member
[font=Arial]Hi Dale. I did not check what was in the combo box in the DatabaseDev code; it is clearly the employee number which is in the default column. This one is easily fixed.[/font]

[font=Arial]In the cboEmployee after update, change the code as follows:
Expand|Select|Wrap|Line Numbers
  1. Private Sub cboEmployee_AfterUpdate()
  2.     UserName = cboEmployee.column(1) '<<< This line sets the global variable to 
  3.                                                  ' the value in the entry combo
  4.     'After selecting user name set focus to password field
  5.     Me.txtPassword.SetFocus
  6. End Sub
This will refer to the name in the second column of the combo box (referred to as column(1) because the numbering is from 0).
-Stewart
[/font]
thankyou so much Stewart. it works :-)
Mar 4 '08 #26

Sign in to post your reply or Sign up for a free account.

Similar topics

1
2134
by: John Davis | last post by:
I put a little login (username and password textfields) in a web page, and once the user able to login, I want the username and password textfields will disappear, and replace with text " has...
1
5445
by: Wayne Smith | last post by:
Applies to: Microsoft FrontPage 2000, Microsoft Access 2000, IIS 5.0 Operating System: Microsoft Windows 2000 Professional I am trying to protect a portion of a web site by allowing users to...
0
3691
by: ruju00 | last post by:
I am getting an error in Login() method of the following class FtpConnection public class FtpConnection { public class FtpException : Exception { public FtpException(string message) :...
1
4507
by: EricRybarczyk | last post by:
I am starting a rewrite of an existing Classic ASP web site in ASP.NET 2.0. The existing ASP application has several types of users, each with a separate login process (separate login page,...
2
4259
by: ad | last post by:
I use login control of VS2005 in my web application. The web applicaiton is developed in my notebook. It run ok in my notebook, but when I login in from another PC with the user ID and password,...
4
4057
tolkienarda
by: tolkienarda | last post by:
Hi all I work for a small webdesign company and we have remote hosting. i built a mysql database with phpmyadmin on the server. i then downloaded and modified a php login page. i am continuing to...
2
1917
by: dylanhughes | last post by:
I'm looking for an example of a login system that has multiple fields (2 to be exact) + password. e.g username, company name and password, the user, company and password are checked against a mysql...
1
3275
by: Adrock952 | last post by:
I have a link on my site which obviously says "Login" where users log in. I would like that link to be changed to "Logout" when the user has successfully logged in and the session has been created...
13
4150
by: Apostle | last post by:
Hi all, after thinking for sometimes, I thought it will be great opportunity to learn if I will start from scratch and build my own register/login system. Here is the thread that I will be posting...
1
1935
by: punk86 | last post by:
Hi, i can register and login without fail. However i notice that my inputs are not record into the database. I do not know the reason. Can someone guide me into login and register. Actually im...
0
7048
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
6911
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
1
6743
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
5344
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
4787
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4488
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
2999
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
2988
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
564
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.