Deadsnows
04-08-2002, 06:44 PM
Ok, this is using the MS Common Control Dialog. I'm writing a program for one of my classes and am stuck fast on one part. This should give you enough info to help me out.
I'm modifying a previous assignment we had so that instead of using CSV files as a database, it uses Access (mdb) files. I have an existing mdb that contains one table. The main form contains a listview window that is used to display the information contained within the mdb file. I've already created the intial display and Add procedures. But I'm having trouble with the Update and Delete Procedures.
My problem is that I can't figure out how to pull a value from the currently selected item in the Listview. When a user clicks on a book in the Listview they can choose to Update or Delete that entry. However, I can't figure out how to call up the correct record inside the mdb file that corresponds to the selection the user made. The "ISBN" column is the primary key (the value I want to search the mdb for).
I understand that I can search for a particular record by using
call datBooks.Recordset.FindFirst("ISBN = '" & ISBN & "'")
And I can pull the record number by declaring RecNbr as a Long variable and using
RecNbr = Clng(Mid(lvwBooks.SelectedItem.Key, 2))
But how the heck do I pull the ISBN from the selected item in the listview and pass it to the Database using the FindFirst method?
Any help is appreciated (although the lab is due by 10:00 pm), any immediate assistance would be great help. Hopefully this post made sense. This is all that I have left to do for the assignment and I've tried everything I can think of.
thanks,
Deadsnows
I'm modifying a previous assignment we had so that instead of using CSV files as a database, it uses Access (mdb) files. I have an existing mdb that contains one table. The main form contains a listview window that is used to display the information contained within the mdb file. I've already created the intial display and Add procedures. But I'm having trouble with the Update and Delete Procedures.
My problem is that I can't figure out how to pull a value from the currently selected item in the Listview. When a user clicks on a book in the Listview they can choose to Update or Delete that entry. However, I can't figure out how to call up the correct record inside the mdb file that corresponds to the selection the user made. The "ISBN" column is the primary key (the value I want to search the mdb for).
I understand that I can search for a particular record by using
call datBooks.Recordset.FindFirst("ISBN = '" & ISBN & "'")
And I can pull the record number by declaring RecNbr as a Long variable and using
RecNbr = Clng(Mid(lvwBooks.SelectedItem.Key, 2))
But how the heck do I pull the ISBN from the selected item in the listview and pass it to the Database using the FindFirst method?
Any help is appreciated (although the lab is due by 10:00 pm), any immediate assistance would be great help. Hopefully this post made sense. This is all that I have left to do for the assignment and I've tried everything I can think of.
thanks,
Deadsnows