Anyway, I have created a small database as a minor practice-project.
However, I cannot seem to get the removal function right. If someone could point me in the direction of a proper tutorial, or if the can give some small bit of advice, that would be great.
Here is the code.
Option Explicit Dim Length As Integer Dim total As Integer Dim File As Integer Private intPosition As Integer Private Type Names Firstname As String * 30 Lastname As String * 30 Telephone As String * 30 Address As String * 30 End Type Dim udtList(1 To 99999) As Names Dim tempNames As Names Public Function GetNames() Dim s As Integer Dim i As Integer Dim recnumber As Integer --------------------------------------------- Private Sub cmdRemove_Click() Dim TEMP As String Dim TEMP2 As String Dim TEMP3 As String Dim TEMP4 As String Dim F As Integer Dim value As String Dim LOOKFOR As String Dim POS As Integer Dim x As Integer LOOKFOR = InputBox("Enter the last name, first name, address, or telephone number of the record you want to delete.") POS = 0 For x = 1 To total If Trim(udtList(x).Lastname) = LOOKFOR Or Trim(udtList(x).Firstname) = LOOKFOR Or Trim(udtList(x).Address) = LOOKFOR Or Trim(udtList(x).Telephone) = LOOKFOR Then POS = 1 Exit For End If Next x If POS = 0 Then MsgBox (LOOKFOR & " was not found.") End If txtSearch.Text = "" If POS = 1 Then TEMP = udtList(x).Lastname TEMP2 = udtList(x).Firstname TEMP3 = udtList(x).Address TEMP4 = udtList(x).Telephone udtList(x).Lastname = udtList(total).Lastname udtList(x).Firstname = udtList(total).Firstname udtList(x).Address = udtList(total).Address udtList(x).Telephone = udtList(total).Telephone udtList(total).Lastname = TEMP udtList(total).Firstname = TEMP2 udtList(total).Address = TEMP3 udtList(total).Telephone = TEMP4 End If
This is basically the code I used, without all the other functions that are irrelevant.
Basically, I tried to use something like my sort function, in order to make the selected record turn into the very last record, and it would then somehow cut out the record, however I lack the knowledge to do it.
The forum search function didn't help either.
This code is obviously not finished, because I can't do it ><;;
This post has been edited by Sever: 07 January 2008 - 04:39 PM