Hi there. I have a module that pulls the user name in the firstname.lastname format. This is the module (module name is fosUserName):
Public Function GetUser() As String
Dim WNet As Object
Set WNet = CreateObject("WScript.Network")
GetUser = WNet.UserName
End Function
I...
The forms control source is a table: DB-USERS
cmbdbUserName is bound to empName
I only brought in empName column into that combo box.
Does this make sense?
Gosh I cant believe I missed that too.
Okay. Fixed. Now ran the code entered a valid username and password and I get the "you do not have access to the database, please contact admin" msgbox.. The if thens on the empty fields is working properly. Ideas?
Private Sub cmdDBLogin_Click()
If...
Agh! Ok. Fixed that. I do not get an error any more but the code isnt working. Says I cannot leave the password empty when I purposely put in the correct password or left it empty to test the code. The code looks right but its not working how it should. Any ideas?
Private Sub...
Here is the code. Sorry...I still don't see where the issue is. I am relatively new to VBA.
Private Sub cmdDBLogin_Click()
If Len(Me.cmbdbUserName & vbNullString) = 0 Then
MsgBox "You cannot leave the UserName field empty, please try again.", vbCritical
Exit Sub
End Sub...
Seems pretty straight forward. I tweaked it to use all of my object names and ran it but got the error: Compile error: Block If without End If
When I click ok and it takes me to the code it highlights the top line below:
Private Sub cmdDBLogin_Click()
If Len(Me.cmbdbUserName &...
Good morning all.
I would like to implement a login form to my DB.
I have a table db-users with three fields: empID; empName; empPassword
I have a form with an unbound combo box: cmbdbUserName
And I have a text box: txtPassword where the user will type in their password.
cmdDBLogin is the...
Thanks for all the help on this thread Paul. You were invaluable!!!
I posted another thread on this same forum:
How do I capture the windows log on information of a user using a database?
If you can help with that one as well...it would be appreciated.
Cheers.
-C.
I was hoping someone could help me with this.
I have several data entry forms in my DB. What I would like to do is capture the windows user name of the people adding records and changing records. How do I go about doing that? I was think of an on change event to a given field that would then...
Paul.
Worked like a charm!
How do I get the setfocus to apply to the the first field where the if then finds a blank field?
Here is the code as it stands.
Private Sub cmdSaveButton_Click()
If Len(Me.cmbModel & vbNullString) = 0 Or Len(Me.txtSerialNo & vbNullString) = 0 Or...
Paul. Many thanks. I have left for the day and will try this out Monday morning. I will report back when I have implemented and tested the code.
Cheers.
C.
Agh. Okay. While I was waiting for your reply I started hacking at it myself. I am taking a slightly different approach. On the Save button I created an on click private sub:
Private Sub cmdSaveButton_Click()
If Len(Me.txtSerialNo & vbNullString) = 0 Then
MsgBox "You need to fill in all...