473,387 Members | 1,303 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Method or data member not found error

mose Mbugua
I'm trying to make a username and password form in access 2007. After keeing in the below code, an error message showing "Method or data member not found" what might be the cause?

Expand|Select|Wrap|Line Numbers
  1. Private Sub Command5_Click()
  2. Username.SetFocus
  3. If Username = "staff1" And Password = "staff1" Then
  4. MsgBox "Access granted", vbInformation, "school system2"
  5. MsgBox "Welcome", vbInformation, "school system"
  6. DoCmd.Close
  7. DoCmd.OpenForm "School_system"
  8. Else
  9. MsgBox "Access denied Please enter your username and password"
  10. else if
  11. End Sub
Sep 1 '14 #1
3 1927
NeoPa
32,556 Expert Mod 16PB
Line #10 says else if instead of End If.

Please read Before Posting (VBA or SQL) Code. This gives tips that will help you so much you won't even have to ask many of the questions you might otherwise need to ask.
Sep 1 '14 #2
i'm trying to make a username and password form in access 2007. After keeing in the below code, an error message showing "Method or data member not found" what might be the cause?a yellow highlight appears on line 1
Expand|Select|Wrap|Line Numbers
  1. Private Sub Command4_Click()
  2. Username.SetFocus
  3. If Username = "staff1" And Password = "staff1" Then
  4. MsgBox "Access Granted", vbInformation, "school system"
  5. MsgBox "Welcome", vbInformation, "school system"
  6. DoCmd.Close
  7. DoCmd.OpenForm "School system"
  8. Else
  9. MsgBox "Access denied. Please enter your username and password"
  10. End If
  11. End Sub
Sep 2 '14 #3
NeoPa
32,556 Expert Mod 16PB
If the highlight is on line #1 then you need to revisit the link I pointed you to in the first post. It means your code is invalid and won't compile. The link tells you how to proceed.
Sep 2 '14 #4

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

Similar topics

0
by: Kenny G | last post by:
Hello, Got a small problem: I built a small table and used the following on my laptop this morning. This code compiled and worked fine on my laptop but when I compiled the first Sub on my...
7
by: Nick J | last post by:
Hi, I keep getting this error message, Compile Error: Method or Data Member not found when trying to compile my access 2000 database ( I want to make an MDE file) although I do not receive this...
2
by: bradleyp | last post by:
Hi all, Hopefully somebody can help. In Access 2002-SP2, I receive an error from the VB Editor if I try to compile the following code (see below). The error is as follows: Compile Error:...
0
by: meetmaruthi | last post by:
Hai i am searching a database (in ms access ) to validate user info.it has two fields username and password. here is the coding and i get compile error:Method or data member not found.please help...
5
by: solrium | last post by:
Good morning, Thanks in advanced.... and Here are the basics: VB 6.3 on W2K, Using for WRQ Reflections for IBM (v 13.0) Visual Basic Editor (built into the above mainframe) - As most...
3
by: DThreadgill | last post by:
Upon trying to compile my db, I get the following error - "Compile Error - Method or Data Member Not Found" and it highlights the .backcolor of the following code Private Sub...
1
by: almeister9 | last post by:
I am hoping someone can help me as I've done this sort of thing before with no problems. I am using Access 2003 SP2 on WinXP prof SP2 I have an unbound form (single form view) with 18 unbound text...
1
by: jayjayplane | last post by:
I have two combo boxes on my form, let's say box1(s1_individual_session) and box2(s1_nationality1), initially I disable box2(gray-out). I want to select box1 value is "true" then enable the box2, ...
1
by: Khalil ur Rehma | last post by:
Error "Method or Data Member not found" here is my code if any one may solve my problem. Dim conDataConnection As Connection Dim strSQL As String Dim lstSel As ListItem Set...
15
by: Elizabeth Mitte | last post by:
Hello, Before I ask my question, I want to say how good this forum is and how much help it has been to a complete novice. At this moment in time I am having trouble creating VBA syntax (I think...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
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...

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.