Results 1 to 4 of 4

Thread: Database File

  1. #1

    Thread Starter
    New Member
    Join Date
    Mar 2005
    Posts
    3

    Talking Database File

    I have attached a file using visual basic 6 that links to access. This file uses random files to store database information. There are a few problems with the program so if anyone knows how to get them sorted can you please reply on this thread.
    Attached Files Attached Files

  2. #2
    Frenzied Member PilgrimPete's Avatar
    Join Date
    Feb 2002
    Posts
    1,313

    Re: Database File

    Welcome to the forums.

    What sort of problems? Could you be more specific, you'll get more help that way...

  3. #3
    Addicted Member Hammad's Avatar
    Join Date
    Mar 2003
    Location
    Pakistan
    Posts
    145

    Re: Database File

    Welcome to Vb Forums.
    Whats ur porblem ??? can you defined us.
    Hammad Umar

  4. #4

    Thread Starter
    New Member
    Join Date
    Mar 2005
    Posts
    3

    Re: Database File

    sorry i took so long to reply but can you tell me what is wrong with the following piece of code. One is to add details of a customer into a random file and the other is to load one piece of that information into a combo box

    Code:
    Private Sub Form_Load()
    Dim num As Integer
    
    customerfile = App.Path & "customerfile.dat"
    
    Open customerfile For Random As #1 Len = Len(customer)
         customercounter = LOF(1) / Len(customer)
        For num = 1 To customercounter
            Get #1, , customer
                cboID.AddItem customer.custID1
        Next num
    Close #1
    End Sub
    Code:
    Private Sub cmdAdd_Click()
        customerfile = App.Path & "customer.dat"
        customer.custID1 = txtCustID1.Text
        customer.surname = txtSurname.Text
        customer.other = txtother.Text
        customer.DOB = txtDOB.Text
        customer.rentals = txtRentals.Text
        customer.tel = txtTel.Text
        customer.mob = txtMob.Text
        customer.add1 = txtAdd1.Text
        customer.add2 = txtAdd2.Text
        customer.add3 = txtAdd3.Text
        customer.postcode = txtPostCode.Text
        customer.town = txtTown.Text
        customer.county = txtCounty.Text
        customer.POCname = txtPOCName.Text
        customer.POCnum = txtPOCNum.Text
        customer.POCpostcode = txtPOCPostCode.Text
        customer.POCtel = txtPOCTel.Text
        customer.Comments = txtComments.Text
        
        If optYes = True Then
        customer.currentcustomer = True
    End If
    If optNo = True Then
        customer.currentcustomer = False
    End If
        customercounter = customercounter + 1
        Open customerfile For Random As #1 Len = Len(customer)
            Put #1, customercounter, customer
        Close #1
    
        txtCustID1 = ""
        txtSurname = ""
        txtother = ""
        txtDOB = ""
        txtRentals = ""
        txtTel = ""
        txtMob = ""
        txtAdd1 = ""
        txtAdd2 = ""
        txtAdd3 = ""
        txtPostCode = ""
        txtTown = ""
        txtCounty = ""
        txtPOCName = ""
        txtPOCNum = ""
        txtPOCPostCode = ""
        txtPOCTel = ""
        txtComments = ""
    Exit Sub
    End Sub
    
    Private Sub cmdClear_Click()
        txtCustID1 = ""
        txtSurname = ""
        txtother = ""
        txtDOB = ""
        txtRentals = ""
        txtTel = ""
        txtMob = ""
        txtAdd1 = ""
        txtAdd2 = ""
        txtAdd3 = ""
        txtPostCode = ""
        txtTown = ""
        txtCounty = ""
        txtPOCName = ""
        txtPOCNum = ""
        txtPOCPostCode = ""
        txtPOCTel = ""
        txtComments = ""
    End Sub

    any help would be appreciated

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