I got a little problem here with Microsoft Access VBA. I'll try to explain it the best way i can.
I created a little form to add a code with a text to a certain database. It is also possible to delete or search Codes. I also added a small list to view all the codes with text that are in the database.
View screenshot: http://img517.images.../problemed.png/
I want to be able to click on the items of the list, this Code and Text gets placed automatically in the textboxes above. The code which i used is this:
Private Sub Listbox_Click() txtCode.Value = Listbox.Column(0) txtTekst.Value = Listbox.Column(1) End Sub
Now, my problem is this: If i click on a code in the list, the record number does not change. So it WILL display the correct code, BUT if i click on 'Verwijderen', which means DELETE, it will delete the WRONG code. As you can see on the screenshot, R12 is the 1st record, and if i click R 13, the record number below will keep saying "1", while i want this to be "2".
I tried to add following code to solve this, but keeps generating error (probably because record number is wrong):
txtZoek.Value = Listbox.Column(0) DoCmd.GoToControl ("txtCode") Docmd.FindRecord Me.txtZoek
txtZoek is the textbox on top (used as search function, DOES work UNTIL a record is clicked)
I know this might sound a little complicated, so if any questions, just ask me, ill reply directly!