Results 1 to 4 of 4

Thread: [RESOLVED] Record problems

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Dec 2005
    Posts
    124

    Resolved [RESOLVED] Record problems

    My record in this program isn't working at all.

    VB Code:
    1. Private Sub Form_Load()
    2.  
    3.     Data(0).DateForm = "frmLoad"
    4.     Data(0).TodayMonth = "January"
    5.     Data(0).TodayMonthNum = 1
    6.     Data(0).TodayDay = 1
    7.     Call CleanDateLoad
    8.     If Data(0).TodayMonth = "December" Then cmdNext.Enabled = False
    9.     If Data(0).TodayMonth <> "January" Then cmdPrev.Enabled = True
    10.     Call MonthCalcDates
    11.    
    12.     'This is here while I work out how to save files
    13.     'This allows me to not have to register each time i run the program
    14.     With CustomerInfo(1)
    15.         .ContactAreaCode = "01273"
    16.         .ContactPhoneNumber = "418377"
    17.         .County = "East Sussex"
    18.         .Email = ""
    19.         .HouseNumber = 5
    20.         .Name = "Adam Swann"
    21.         .password = "password"
    22.         .Postcode = "BN3 8LA"
    23.         .StreetName = "Dale View"
    24.         .username = "zbo"
    25.     End With
    26.    
    27.     Data(0).TotalUsers = 1 'Change this when i know how to save files
    28. End Sub

    Here you can see that I've added the record under the user name zbo, but here when i search for it

    VB Code:
    1. Private Sub cmdLogIn_Click()
    2.     Dim Contiune As Boolean
    3.     Dim index As Integer
    4.     Dim username As String
    5.     Dim password As String
    6.     index = 0
    7.     Contiune = False
    8.     username = txtUserName.Text
    9.     password = txtPassword.Text
    10.  
    11.     Do While Contiune = False
    12.         index = index + 1
    13.         If UCase(Trim(CustomerInfo(index).username)) = UCase(Trim(username)) Then
    14.             Continue = True
    15.         End If
    16.        
    17.         If index = 1092 Then
    18.             MsgBox ("The user name you enterd doesn't exsit, please re-enter it")
    19.             txtUserName.Text = ""
    20.             txtPassword.Text = ""
    21.             Exit Sub
    22.         End If
    23.     Loop
    24.    
    25.     If password = (RTrim(LTrim(CustomerInfo(index).password))) Then
    26.         frmBooking.Show
    27.         Unload Me
    28.     Else
    29.         MsgBox ("The password you enterd was incorrect, please re-enter it")
    30.         txtPassword.Text = ""
    31.     End If
    32. End Sub

    it says that the user name dosn't exsit. but it clearly is under CustomerInfo(1) heres the modual incase thiers a problem with that.

    VB Code:
    1. Public Type CustomerInfoType
    2.     username As String * 15
    3.     password As String * 15
    4.     Name As String * 40
    5.     Email As String * 50
    6.     ContactAreaCode As String * 5
    7.     ContactPhoneNumber As String * 6
    8.     HouseNumber As Integer
    9.     StreetName As String * 30
    10.     County As String * 30
    11.     Postcode As String * 8
    12. End Type
    13. Public CustomerInfo(1 To 1092) As CustomerInfoType

    So can anyone see any problems with this code?

    I can't uplaod any forms as when i click the 'Manage attachments' button i don't get anything up, just a blank window. in fact that happens when ever i open a new webpage.


    Cheers,
    Ichar

  2. #2
    Frenzied Member oh1mie's Avatar
    Join Date
    Sep 2001
    Location
    Finland
    Posts
    1,043

    Re: Record problems

    Your declare is misstyped

    VB Code:
    1. Dim Contiune As Boolean
    2.  
    3. If UCase(Trim(CustomerInfo(index).username)) = UCase(Trim(username)) Then
    4.   ' Correct to Contiune
    5.    Continue = True
    6. End If
    oh1mie/Vic


  3. #3
    old fart Frans C's Avatar
    Join Date
    Oct 1999
    Location
    the Netherlands
    Posts
    2,926

    Re: Record problems

    You can avoid this kind of errors if you use Option Explicit.
    Put at the first line of your code the following textL
    Option Explicit
    Now you will be warned if a variable is not declared.
    To have the IDE put it automitcally there for each new module, go to Tools --> Options, and check "Require Variable Declaration" on tab Editor
    Frans

  4. #4

    Thread Starter
    Lively Member
    Join Date
    Dec 2005
    Posts
    124

    Re: Record problems

    thanks guys. Somtimes it just helps to have another pair of eyes look over it. thanks again

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width