473,513 Members | 3,777 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

MS Access: How do I Disable Form unless UserType is Admin

1 New Member
Hello,

I'm new to here.

My question is i have a table called tblLogin and it has Username and Password and Usertype in it Admin, Normal in usertype. How can i get when the user logs in as admin it shows cmsAdmin and if not admin they are normal it disables cmsAdmin this is the code i currently use for my login system.

Expand|Select|Wrap|Line Numbers
  1. Public Class frmLogin
  2.     Dim vrfy As Boolean
  3.  
  4.     Private Sub frmLogin_FormClosed(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosedEventArgs) Handles Me.FormClosed
  5.         If vrfy = False Then
  6.             End
  7.         End If
  8.     End Sub
  9.  
  10.     Private Sub cmdLogin_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdLogin.Click
  11.  
  12.         Call IsConnected("Select * from tblAdmin where Username='" & Me.TextBox1.Text & "' and Password='" & Me.TextBox2.Text & "'", False)
  13.  
  14.         If MyDr.Read = True Then
  15.             frmMain.Show()
  16.             frmMain.cmdLogout.Text = "Logout"
  17.         Else
  18.             MsgBox("Access Denied!", MsgBoxStyle.Critical, "Error")
  19.             Call IsConnected("Insert into tblLog values('" & _
  20.                 Me.TextBox1.Text & "','" & _
  21.                 Me.txtDate.Text & "','" & _
  22.                 Me.txtTime.Text & "')", True)
  23.         End If
  24.  
  25.         TextBox1.Text = ""
  26.         TextBox2.Text = ""
  27.         TextBox1.Focus()
  28.  
  29.     End Sub
  30.  
  31.  
  32.     Private Sub cmdClose_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdClose.Click
  33.         Me.Close()
  34.     End Sub
  35.  
  36.     Private Sub frmLogin_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
  37.         txtDate.Text = Now.ToString("dd/MM/yyy")
  38.         txtTime.Text = Now.ToString("hh:mm:ss tt")
  39.     End Sub
  40. End Class
Jan 20 '12 #1
1 1889
NeoPa
32,558 Recognized Expert Moderator MVP
This is a VB.NET question and doesn't ask anything Access specific so I'll move it across for you to the relevant forum.

I expect the experts there will want some more basic information about what objects you're working with before they can be much help, but I'll leave that to you and they to sort out.
Jan 20 '12 #2

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

Similar topics

1
12761
by: El_Embozador | last post by:
Hi , please can you tell how i can print an MS ACCESS Report form visual basic, i ned a sample code .. Thanks
0
3608
by: Colin | last post by:
"There is no object in this control" in Access 97 form with registered MSINET.OCX on XP machine I have an Access 97 database that I made a form with using the Microsoft Internet Transfer control (MSINET.OCX). I want another user to use this database. We both have XP machines. I copied the MSINET.OCX to hers c:\windows\system32\ directory...
1
10933
by: bailee220 | last post by:
I have included the following code to open an Access database form from within an exsisting Access database. But when I run the code, it appears that it opens the database because in windows explorer I can see the database has the .ldb file extension. So it appears that it's open, but I can't see the database or the form that I've tried to...
4
8364
by: Kevin Myers | last post by:
Hello, Please forgive my reposting of this note with hopefully a more relevant subject line. On an Access 2000 form under Windows 2000 I would like to use a Kodak Image Edit Control to display the contents of a TIFF image file. According to the very limited documentation that I have been able to locate so far, all I should need to do is...
0
252
by: PC User | last post by:
============================= Problem: ============================= How to printout a richtextbox on an MS Access 2K form. ============================= ============================= Step by Step Solution: =============================
4
2885
by: Chris Lane | last post by:
I have a form declared like this in the html <form id="SearchResults" method="post" runat="server" name="frmMain"></form> I don't see the form anywhere in the codebehind and I am not able to access it like this Me.frmMain or Me.SearchResults. Is it not possible to access the form from the code behind or am I missing something?
3
2245
by: emajka21 | last post by:
Hello, and thank you in advance for trying to help me. I am trying to create an access 2000 form without using the wizard. It just doesn't seem like I can the level of complexity I want out of the wizard so I want to hand code the form. If this was any other language accessing an access form I know how to do it but I am not sure how to access...
1
2849
by: Mike Thompson | last post by:
I have an event handler defined within a class. It has the following signature: static void XYZ_EventHandler (object sender, XYZEventArgs e) From within this event handler, I want to access the contents of a textbox on the form that is defined within the default Form1 class. Ordinarily, I would pass the form to any class member function...
0
3113
by: Yarik | last post by:
Hello, Here is a sample (and very simple) code that binds an Access 2003 form to a fabricated ADO recordset: ' Create recordset... Dim rs As ADODB.Recordset: Set rs = New ADODB.Recordset ' Append one or more fields... Call rs.Fields.Append("Number", adInteger)
5
9778
by: sphinney | last post by:
Basic question: Does anyone know how to go about adding a control to an Access 2007 form that will allow viewing a Word 2007 document? Reason for asking: My office is about to receive 100+/- Word 2007 documents that contain data that needs to be imported into various fields of an Access 2007 table. To facilitate the import process, I was...
0
7270
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7563
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7125
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
5703
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5102
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
4757
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3239
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1612
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
813
muto222
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.