Visual Basic Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsProgrammingVisual Basic Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread ASP Free Forums Sponsor:
  #1  
Old November 4th, 2007, 04:29 AM
EagleEye EagleEye is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Nov 2007
Posts: 12 EagleEye User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 h 4 m 23 sec
Reputation Power: 0
Password system problem

stuck on a password system i've thought up. in logic it should work im not sure why it isn't working though.

my code goes:
Code:
Private Sub Form_Load()
Dim Passenter As String
Dim Password As String
Dim entry As Boolean
entry = False
    Passenter = InputBox("Please Enter A Password", "Password Entry")
'Passenter is the name for the answer the user gives when prompted with the input box
    If Password = "" Then
        Password = Passenter
        MsgBox "This is your new password", vbInformation, "New Password"
        entry = True
'If the password has not been entered before then the password JUST entered by the user becomes the new password
    Else
        If Passenter = Password Then
            entry = True
        Else
            entry = False
        End If
'If you entered the matching password then you may continue
    End If
End Sub


Now, it works up untill there, I've added a watch and the variables are sweet. I think it's the next part that's the problem.

Code:
Private Sub Continue_Click()
    If entry = False Then
       MsgBox "You do not have rights to access this page", vbExclamation, "Access Denied"
'Show an "access denied" message
    Else
        MainForm.Visible = True
        SplashForm.Visible = False
'Hide the current (splash) form and open the main menu
    End If
End Sub


Where I've highlighted is what comes up everytime, that msgbox, it just won't allow me entry.



If anyone could help it'd be much appreciated

Last edited by Shadow Wizard : November 4th, 2007 at 11:02 AM. Reason: added [Code] and [/Code] tags around code please do that yourself next.

Reply With Quote
  #2  
Old November 4th, 2007, 11:04 AM
Shadow Wizard's Avatar
Shadow Wizard Shadow Wizard is offline
Moderator From Beyond
ASP Free God 46th Plane (27500 - 27999 posts)
 
Join Date: Sep 2004
Location: Israel
Posts: 27,932 Shadow Wizard User rank is General 15th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 15th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 15th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 15th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 15th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 15th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 15th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 15th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 15th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 15th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 15th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 15th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 15th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 15th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 15th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 15th Grade (Above 100000 Reputation Level)  Folding Points: 391471 Folding Title: Super Ultimate Folder - Level 1Folding Points: 391471 Folding Title: Super Ultimate Folder - Level 1Folding Points: 391471 Folding Title: Super Ultimate Folder - Level 1Folding Points: 391471 Folding Title: Super Ultimate Folder - Level 1Folding Points: 391471 Folding Title: Super Ultimate Folder - Level 1Folding Points: 391471 Folding Title: Super Ultimate Folder - Level 1
Time spent in forums: 3 Months 2 Weeks 12 h 17 m 53 sec
Reputation Power: 2002
you must declare your "entry" variable as global variable otherwise in the second
sub routine it won't "recognize" the variable, or more accurate to say it would
be considered local variable in the first sub routine, and would be "killed" when
the routine is over.

to declare global variable, move its declaration to be outside of any sub routine.
(declaration is the line with Dim)

Reply With Quote
  #3  
Old November 5th, 2007, 02:03 AM
EagleEye EagleEye is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Nov 2007
Posts: 12 EagleEye User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 h 4 m 23 sec
Reputation Power: 0
Quote:
Originally Posted by Shadow Wizard
you must declare your "entry" variable as global variable otherwise in the second
sub routine it won't "recognize" the variable, or more accurate to say it would
be considered local variable in the first sub routine, and would be "killed" when
the routine is over.

to declare global variable, move its declaration to be outside of any sub routine.
(declaration is the line with Dim)


Thanks mate you're a legend, working sweet as a toffee apple now

Reply With Quote
  #4  
Old November 5th, 2007, 02:33 AM
EagleEye EagleEye is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Nov 2007
Posts: 12 EagleEye User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 h 4 m 23 sec
Reputation Power: 0
hmm

actualy ive stumbled across another dilemna, ive tried to save my password to disk now and the password that IS saved isn't being written to the textbox upon form_load like i instructed it to.


Here is the code i have changed.
Code:
Public Sub Form_Load()
Dim Password As String
Dim Datafile As String
Dim Datafile2 As String
Dim contents As String
Datafile = "C:\Documents and Settings\Sam\My Documents\School\Computers\Assignment\Program_File  s\HawKorp\Address_Book\pass.dat"
entry = False
    Open Datafile For Input As 1
    Do While Not EOF(1)
    Line Input #1, contents
    PassBox.Text = PassBox.Text & Conents
    Loop
    Close 1
    PassEntBox.Text = InputBox("Please Enter A Password", "Password Entry")
'passentbox.text is the name for the answer the user gives when prompted with the input box
    If PassBox.Text = "" Then
        Open Datafile For Output As 1
        Print #1, PassEntBox.Text
        Close 1
        MsgBox "This is your new password: " & PassBox.Text, vbInformation, "New Password"
        entry = True
'If the password has not been entered before then the password JUST entered by the user becomes the new password
    Else
        If PassEntBox.Text = PassBox.Text Then
            entry = True
        Else
            entry = False
        End If
'If you entered the matching password then you may continue
    End If
End Sub


EDIT: Nevermind - just got the contents spelt wrong lol

Reply With Quote
  #5  
Old November 5th, 2007, 05:50 AM
Shadow Wizard's Avatar
Shadow Wizard Shadow Wizard is offline
Moderator From Beyond
ASP Free God 46th Plane (27500 - 27999 posts)
 
Join Date: Sep 2004
Location: Israel
Posts: 27,932 Shadow Wizard User rank is General 15th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 15th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 15th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 15th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 15th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 15th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 15th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 15th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 15th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 15th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 15th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 15th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 15th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 15th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 15th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 15th Grade (Above 100000 Reputation Level)  Folding Points: 391471 Folding Title: Super Ultimate Folder - Level 1Folding Points: 391471 Folding Title: Super Ultimate Folder - Level 1Folding Points: 391471 Folding Title: Super Ultimate Folder - Level 1Folding Points: 391471 Folding Title: Super Ultimate Folder - Level 1Folding Points: 391471 Folding Title: Super Ultimate Folder - Level 1Folding Points: 391471 Folding Title: Super Ultimate Folder - Level 1
Time spent in forums: 3 Months 2 Weeks 12 h 17 m 53 sec
Reputation Power: 2002
you better start using Option Explicit. using it will force you to
declare your variables which is rule #1 of programming, IMO
and as nice bonus, you'll get friendly "variable undefined" error
for each typo you make.

Reply With Quote
  #6  
Old November 5th, 2007, 05:54 AM
EagleEye EagleEye is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Nov 2007
Posts: 12 EagleEye User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 h 4 m 23 sec
Reputation Power: 0
it's not that i dont declare them it's just i declared it incorrectly last time.

FYI noone in my class @ school could pick it up :s (pretty worrying)

Reply With Quote
  #7  
Old November 5th, 2007, 06:07 AM
Shadow Wizard's Avatar
Shadow Wizard Shadow Wizard is offline
Moderator From Beyond
ASP Free God 46th Plane (27500 - 27999 posts)
 
Join Date: Sep 2004
Location: Israel
Posts: 27,932 Shadow Wizard User rank is General 15th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 15th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 15th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 15th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 15th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 15th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 15th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 15th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 15th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 15th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 15th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 15th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 15th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 15th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 15th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 15th Grade (Above 100000 Reputation Level)  Folding Points: 391471 Folding Title: Super Ultimate Folder - Level 1Folding Points: 391471 Folding Title: Super Ultimate Folder - Level 1Folding Points: 391471 Folding Title: Super Ultimate Folder - Level 1Folding Points: 391471 Folding Title: Super Ultimate Folder - Level 1Folding Points: 391471 Folding Title: Super Ultimate Folder - Level 1Folding Points: 391471 Folding Title: Super Ultimate Folder - Level 1
Time spent in forums: 3 Months 2 Weeks 12 h 17 m 53 sec
Reputation Power: 2002
as I said, if you'll have Option Explicit, you'll get compilation errors when
you'll have such typo again - much better, don't you think?

Reply With Quote
  #8  
Old November 5th, 2007, 06:52 AM
EagleEye EagleEye is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Nov 2007
Posts: 12 EagleEye User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 h 4 m 23 sec
Reputation Power: 0
can you give me a link to download it? if it's something i have to but im not going to bother with it. this is just an assignment for school, im not going to be using VB for very long.

Reply With Quote
  #9  
Old November 5th, 2007, 06:57 AM
Shadow Wizard's Avatar
Shadow Wizard Shadow Wizard is offline
Moderator From Beyond
ASP Free God 46th Plane (27500 - 27999 posts)
 
Join Date: Sep 2004
Location: Israel
Posts: 27,932 Shadow Wizard User rank is General 15th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 15th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 15th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 15th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 15th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 15th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 15th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 15th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 15th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 15th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 15th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 15th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 15th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 15th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 15th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 15th Grade (Above 100000 Reputation Level)  Folding Points: 391471 Folding Title: Super Ultimate Folder - Level 1Folding Points: 391471 Folding Title: Super Ultimate Folder - Level 1Folding Points: 391471 Folding Title: Super Ultimate Folder - Level 1Folding Points: 391471 Folding Title: Super Ultimate Folder - Level 1Folding Points: 391471 Folding Title: Super Ultimate Folder - Level 1Folding Points: 391471 Folding Title: Super Ultimate Folder - Level 1
Time spent in forums: 3 Months 2 Weeks 12 h 17 m 53 sec
Reputation Power: 2002
download what?
here is the official documentation:
http://msdn2.microsoft.com/en-us/li...s4f(VS.80).aspx

Reply With Quote
  #10  
Old November 10th, 2007, 10:08 PM
EagleEye EagleEye is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Nov 2007
Posts: 12 EagleEye User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 h 4 m 23 sec
Reputation Power: 0
erm ok in the same project im having a new problem >.> my "Add Contact" Button isn't working. What's happening is it says that the path isn't found. I've already declared the path in my form_load though:

Code:
Public Sub Form_Load()
    DataCountContact = "I:\Sam's IPT Assignment\Program_Files\HawKorp\Address_Book\Coun  tContact.dat"
    DataFName = "I:\Sam's IPT Assignment\Program_Files\HawKorp\Address_Book\Cont  act" & CountContact & "Field1.dat"
    DataSName = "I:\Sam's IPT Assignment\Program_Files\HawKorp\Address_Book\Cont  act" & CountContact & "Field2.dat"
    DataAddress = "I:\Sam's IPT Assignment\Program_Files\HawKorp\Address_Book\Cont  act" & CountContact & "Field3.dat"
    DataSuburb = "I:\Sam's IPT Assignment\Program_Files\HawKorp\Address_Book\Cont  act" & CountContact & "Field4.dat"
    DataState = "I:\Sam's IPT Assignment\Program_Files\HawKorp\Address_Book\Cont  act" & CountContact & "Field5.dat"
    DataPHNumber = "I:\Sam's IPT Assignment\Program_Files\HawKorp\Address_Book\Cont  act" & CountContact & "Field6.dat"
    DataDOB = "I:\Sam's IPT Assignment\Program_Files\HawKorp\Address_Book\Cont  act" & CountContact & "Field7.dat"
    DataComments = "I:\Sam's IPT Assignment\Program_Files\HawKorp\Address_Book\Cont  act" & CountContact & "Field8.dat"

End Sub


Code:
Private Sub AddCont_Click()
    Dim Contact As Record
    Dim CountField As Integer
    Dim CountContact As Integer
    Dim Datafile As String
   Open DataCountContact For Input As 10
    Do While Not EOF(10)
        Line Input #10, contents
        Close 11
        MainCountContact.Text = contents
    Loop
    Close 10
    CountContact = MainCountContact.Text
    'Retrieve Contact Number
    CountField = 1
    Datafile = "I:\Sam's IPT Assignment\Program_Files\HawKorp\Address_Book\Cont  act" & CountContact & "Field" & CountField & ".dat"
        With Contact
        .FName = InputBox("Please Enter First Name", "First Name Entry")
        End With
            TempCont.Text = Contact.FName
            Open Datafile For Output As 1
            Print #1, TempCont.Text
            Close 1
            CountField = CountField + 1
        'Save FName data
        With Contact
        .SName = InputBox("Please Enter Surname", "Surname Entry")
        End With
            TempCont.Text = Contact.SName
            Open Datafile For Output As 2
            Print #2, TempCont.Text
            Close 2
            CountField = CountField + 1
            'Save SName data
        With Contact
        .Address = InputBox("Please Enter Address", "Address Entry")
        End With
            TempCont.Text = Contact.Address
            Open Datafile For Output As 3
            Print #3, TempCont.Text
            Close 3
            CountField = CountField + 1
            'Save Address data
        With Contact
        .Suburb = InputBox("Please Enter Suburb", "Suburb Entry")
        End With
            TempCont.Text = Contact.Suburb
            Open Datafile For Output As 4
            Print #4, TempCont.Text
            Close 4
            CountField = CountField + 1
            'Save Suburb data
        With Contact
        .State = InputBox("Please Enter State", "State Entry")
        End With
            TempCont.Text = Contact.State
            Open Datafile For Output As 5
            Print #5, TempCont.Text
            Close 5
            CountField = CountField + 1
            'Save State data
        With Contact
        .PHNumber = InputBox("Please Enter Phone Number", "Phone Number Entry")
        End With
            TempCont.Text = Contact.PHNumber
            Open Datafile For Output As 6
            Print #6, TempCont.Text
            Close 6
            CountField = CountField + 1
            'Save PHNumber data
        With Contact
        .DOB = InputBox("Please Enter Date of Birth", "Date of Birth Entry")
        End With
            TempCont.Text = Contact.DOB
            Open Datafile For Output As 7
            Print #7, TempCont.Text
            Close 7
            CountField = CountField + 1
            'Save DOB data
        With Contact
        .Comments = InputBox("Please Enter Comments", "Comments Entry")
        End With
            TempCont.Text = Contact.Comments
            Open Datafile For Output As 8
            Print #8, TempCont.Text
            Close 8
            'Save Comments data
        Open DataCountContact For Output As 9
        Print #9, CountContact
        Close 9
        'Save contact number
End Sub


And here's my global module:

Code:
Public entry As Boolean
Public Type Record
    FName As String
    SName As String
    Address As String
    Suburb As String
    State As String
    PHNumber As String
    DOB As String
    Comments As String
End Type
Public CountContact As Integer
Public CountField As Integer
Public DataCountContact As String
Public DataFName As String
Public DataSName As String
Public DataAddress As String
Public DataSuburb As String
Public DataState As String
Public DataPHNumber As String
Public DataDOB As String
Public DataComments As String

Reply With Quote
  #11  
Old November 11th, 2007, 03:34 AM
Shadow Wizard's Avatar
Shadow Wizard Shadow Wizard is offline
Moderator From Beyond
ASP Free God 46th Plane (27500 - 27999 posts)
 
Join Date: Sep 2004
Location: Israel
Posts: 27,932 Shadow Wizard User rank is General 15th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 15th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 15th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 15th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 15th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 15th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 15th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 15th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 15th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 15th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 15th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 15th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 15th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 15th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 15th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 15th Grade (Above 100000 Reputation Level)  Folding Points: 391471 Folding Title: Super Ultimate Folder - Level 1Folding Points: 391471 Folding Title: Super Ultimate Folder - Level 1Folding Points: 391471 Folding Title: Super Ultimate Folder - Level 1Folding Points: 391471 Folding Title: Super Ultimate Folder - Level 1Folding Points: 391471 Folding Title: Super Ultimate Folder - Level 1Folding Points: 391471 Folding Title: Super Ultimate Folder - Level 1
Time spent in forums: 3 Months 2 Weeks 12 h 17 m 53 sec
Reputation Power: 2002
debug your code: what's the value of DataCountContact when you try opening it?
what is drive "I:"? is it mapped network drive? do you have permissions there?

Reply With Quote
  #12  
Old November 11th, 2007, 04:00 AM
EagleEye EagleEye is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Nov 2007
Posts: 12 EagleEye User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 h 4 m 23 sec
Reputation Power: 0
Quote:
Originally Posted by Shadow Wizard
debug your code: what's the value of DataCountContact when you try opening it?
what is drive "I:"? is it mapped network drive? do you have permissions there?


I: is my usb

the value of DataCountContact is non-existant at this point cuz its the first contact ive tried adding.

here's my updated addcontact_click code:
Code:
Private Sub AddCont_Click()
    Dim Contact As Record
    Dim CountField As Integer
    Dim CountContact As Integer
    Dim Datafile As String
    Open DataCountContact For Input As 10
    Do While Not EOF(10)
    Line Input #10, contents
    MainCountContact.Text = contents
    Loop
    Close 10
    If MainCountContact.Text = "" Then
    MainCountContact.Text = "1"
    Else
    CountContact = MainCountContact.Text + 1
    End If
    'Retrieve Contact Number
    CountField = 1
    Datafile = "I:\Sam's IPT Assignment\Program_Files\HawKorp\Address_Book\Cont  act" & CountContact & "Field" & CountField & ".dat"
        With Contact
        .FName = InputBox("Please Enter First Name", "First Name Entry")
        End With
            TempCont.Text = Contact.FName
            Open Datafile For Output As 1
            Print #1, TempCont.Text
            Close 1
            CountField = CountField + 1
        'Save FName data
        With Contact
        .SName = InputBox("Please Enter Surname", "Surname Entry")
        End With
            TempCont.Text = Contact.SName
            Open Datafile For Output As 2
            Print #2, TempCont.Text
            Close 2
            CountField = CountField + 1
            'Save SName data
        With Contact
        .Address = InputBox("Please Enter Address", "Address Entry")
        End With
            TempCont.Text = Contact.Address
            Open Datafile For Output As 3
            Print #3, TempCont.Text
            Close 3
            CountField = CountField + 1
            'Save Address data
        With Contact
        .Suburb = InputBox("Please Enter Suburb", "Suburb Entry")
        End With
            TempCont.Text = Contact.Suburb
            Open Datafile For Output As 4
            Print #4, TempCont.Text
            Close 4
            CountField = CountField + 1
            'Save Suburb data
        With Contact
        .State = InputBox("Please Enter State", "State Entry")
        End With
            TempCont.Text = Contact.State
            Open Datafile For Output As 5
            Print #5, TempCont.Text
            Close 5
            CountField