473,403 Members | 2,359 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,403 software developers and data experts.

something resetting status of select case or multi-line if statements

I have an odd situtation where a section of code is resetting the status of either multi line If statments which then gives me the error " end if without block if" or something very similure, or select case where it's giving me " Case without Select case"
here is the offfending code.
Expand|Select|Wrap|Line Numbers
  1. Private Sub loginbutton_Click()
  2. Dim rs As Recordset
  3. Dim db As Database
  4. Set db = CurrentDb
  5. Dim searchstr As String
  6. 'If Not DLookup("Password", "Security", "Employee = " & SelID) = DigestStrToHexStr(Me.pass) Then
  7.     'Exit Sub
  8. Select Case logasadmin
  9.     Case False
  10.  
  11.         searchstr = "SELECT * FROM Security WHERE Employee = " & Chr(34) & Nz(Me![SelID], 0) & Chr(34)
  12.         Set rs = db.OpenRecordset(searchstr, dbOpenDynaset)
  13.         With rs
  14.         .Fields("Computerlogin") = Environ("username")
  15.         .Update
  16.         .Close
  17.         GBL_login = True
  18.     Case True
  19.     If Nz(DLookup("Password", "Security", "Employee = 666666")) = DigestStrToHexStr(Me.pass) Then
  20.             stDocName = "Adminwarning"
  21.             DoCmd.OpenForm stDocName, , , stLinkCriteria
  22.             GBL_login = True
  23.     End If
  24. End Select
  25.     searchstr = "SELECT * FROM Security WHERE computerlogin = " & Chr(34) & Nz(Me![userid], 0) & Chr(34)
  26.     If DLookup("password", "Security", "Computerlogin = " & Environ("username")) = DigestStrToHexStr(Me.pass) Then
  27.         GBL_login = True
  28.     End If
  29.  
  30.  
  31.     DoCmd.Close
  32. End Sub
it's curently giving the "Case without Select case" on the Case True line.
Jul 22 '10 #1

✓ answered by NeoPa

There is no closing End With to match the With rs of line #13.

3 2318
NeoPa
32,556 Expert Mod 16PB
There is no closing End With to match the With rs of line #13.
Jul 22 '10 #2
Thank you so much!! I have been beating my head on my desk all morning. Microsoft error messages are so helpfull when debugging GRR
Jul 22 '10 #3
NeoPa
32,556 Expert Mod 16PB
Pleased to help Lee :)
lee weaver: Microsoft error messages are so helpfull when debugging GRR
Quite true, but you can help yourself there, by using code indenting properly.
  • Properly indented code (whichever system you choose) is invaluable.
  • Non-indented code is hard to read.
  • Badly indented code (where it is indented but not matching any system) is creating a rod for your own back.

Short version - Indenting properly can help you greatly. Especially with finding bugs.

Welcome to Bytes!
Jul 22 '10 #4

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

Similar topics

17
by: Newbie | last post by:
Dear friends, I am having a hard time understanding how to use a SELECT CASE in ASP. I have used it in VB but never in ASP scripting. Scenerio: I have 2 textboxes on a form that I have to...
0
by: aceofhartz | last post by:
hello everyone, i have a multiple choice exam program i am working on and have run into a (hopefully) easy problem. here is my question: i have 4 radiobuttons (bound to an "answercode" field in...
2
by: Ini | last post by:
Hi, I have a recordset containing names of photographs and descriptions of these photo's. For exempla: Photo: car01.jpg Description: Red Corvette
4
by: Terencetrent | last post by:
I having been using Access '97/2002 for about 4 years now and have never really had the need or the time to learn visual basic. Well, I think the time has finally come. I need help with Visual...
7
by: Lauren Quantrell | last post by:
Is there any speed/resource advantage/disadvantage in using Select Case x Case 1 Case 2 etc. many more cases... End Select VS.
3
by: pgraeve | last post by:
I am a convert from VB to C# so bear with me on this "conversion" question C# switch statement seems to be the closest relative to VB's Select Case. I used VB's Select Case statement liberally. ...
1
by: William Gower | last post by:
I have a form where I display a textbox depending on a value in a field. In the asp verision I did a Select Case and depending on whether the field concerned was a 1, 2 or 3, I display different...
6
by: BluDog | last post by:
Hi If i am using a Select... Case is there any way to have the elements of an array tested within a case, for example: Dim MyChar as Char Select Case MyChar Case "a"c, "b"c, "c"c 'Do...
5
by: PJ6 | last post by:
Select Case o.GetType Case = GetType(SomeRandomTypeName) '... End Select Why doesn't this work? Can I make it work or am I stuck with ElseIf for a long list? Paul
6
by: Spam Catcher | last post by:
Does anyone know why this doesn't work: Select Case X Case X or Y msgbox("hello world!") End Select It seems X or Y doesn't evaluate correctly (I think only the first 1/2 is
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
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...
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
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
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,...

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.