Edit A Record Via Form

I haven't got time to look at your database blk133, but I am strongly against using subform in any scenario. I have got too much pain from it when few years ago I started my access study.

The best solution is. Create a query which you want you subform to present. Add a lisbox to the form, change its rowsource property to the query you create, change bound column to the column you want to use as the value of selected data (primary key normally).

Now you have a subform that decouple from the data source. You can use listbox1.value to retrieve the value of selected item.

You can create a query with parameter, when you need to change the criteria, just give a new value to that query then requery the listbox.
 
I have it set so that once you click the Search button in changes the recordset.

But I like your idea better. I'll change it.
Could you tell me how can I bring in the data from the table into unbound text box on the form? What is the code for that? I don't want to use combo box or list box.
 
Last edited:
Check out the database attached.

You search table "Book" by book id and represent result in a list box.
 

Attachments

aikea,
Thanks for the attachment, but I want every table field to be displayed in the text box so that user can modify any field he/she likes. Just like I have it in my attachment. What I want is for change to take effect only after Save button is pressed.
 
I think you need some serious VBA and ADO lesson. Add a new record in ADO is quite basic for an Access developer.

Dim rs as new adodb.recordset
rs.activeconnection=currentproject.connection
rs.source=tablename
rs.open
do while not rs.eof
if rs["id"].value = idyouaresearching then
rs["fieldname"].value=valueyouwanttochange
end if
rs.movenext
loop
rs.close
 

Users who are viewing this thread

Back
Top Bottom