Selecting a Record to update from a unbound combobox (1 Viewer)

l3on

New member
Local time
Today, 17:12
Joined
May 26, 2008
Messages
8
Hello, firstly I do appreciate this forum and the advice given. It has been a great source of information whilst lurking and I have been able to slowly build my current database correctly with the desired result (well I hope). However, I have run into a problem that I can't figure out the correct solution. I have tried to find information for a solution and been unsuccessful hence the thead. I hope you can help.

The problem
The aim of the form is to select a record from a listbox. The listbox contains a hidden first column containing the record ID. Once the record is selected, the field information is displayed so the user can edit any field. I decided link the form to a query and use an update to replace the table data, my reasoning is incase the user cancels the operation mid-edit. The query criteria is the record ID from the list box.

The query returns the field information, however I cannot get the textboxs to display the field information when a record is selected.

Can someone give me a nudge in the right direction.
 

wazz

Super Moderator
Local time
Today, 15:42
Joined
Jun 29, 2004
Messages
1,711
the textboxes will have to be bound to the fields in the (a) query. if they aren't bound they won't show anything.

- when you select a row in the listbox you want the form to go to the selected record. use the afterupdate event of the listbox to go to the record (afterupdate of the listbox happens when you click the listbox):
listbox_afterupdate
Me.Requery
- since the query criteria is the record ID from the list box, when you select a new row in the listbox, run the query again, or, in other words, requery the form.

if you want users to be able to cancel the edit, add a cancel button. the code is simple:
- msgbox to confirm cancel
- if yes*: Me.Undo 'returns all changes to original values.
- if no: exit 'do nothing.
 
Last edited:

wiklendt

i recommend chocolate
Local time
Today, 17:42
Joined
Mar 10, 2008
Messages
1,746
i have a different way of doing this - i have a "new" button and a "delete" button. simple. ;-)
 

Users who are viewing this thread

Top Bottom