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.
Printable View
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.
Welcome to the forums.
What sort of problems? Could you be more specific, you'll get more help that way...
Welcome to Vb Forums.
Whats ur porblem ??? can you defined us.
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