0
votes

This is complicated. I'm not too familiar with Access and I am a programmer (meaning, I might be making this harder on myself and not seeing the "easy" answer).

So let's consider (example): We have a library database thing. I have a specific copy of a book. My book can have several status: checked out, on shelf, destroyed, smells weird/sticky/out of commission.... I need/have two forms in Access. One for basic info on my book and one to actually update the status. With a status change there's a significant amount of data that needs to be recorded so this requires a seperate form. The book form itself just consists of basic information and a small sub form for rental history; the book form needs to include current status. My actual status table has a statusid, bookid, timestamp.

Now... since I didn't know Access would have an issue with it... I left both my book and status forms unbound and filled them with a recorset/query from VBA. But then it yelled at me when I tried to connect the two; "unbound" it told me. I decided that's fine and moved the query over to the actual front end Access Query section (to the left) and out of the vba and bound my forms appropriately. BUT NOW. It says my record set is not updateable. I assume because I used joins and nested select statements and such to get the current status for the book. I just need to be able to modify those text fields and I can write the insert/update whatever myself. I found a few things on the net saying to create a table but I also read that doesn't work in a multiuser environment. When the book form is open and the user clicks a button to change the status of my book and the saves/closes that status form I do need to be able to requery the book form to show the updated status.

So... What do I do?

1
Oh. Do I just need to bind the book form to the book table and any extra data (like current status) not in that table get that through a vba query? And handle upating it through Form_Current()?gloomy.penguin

1 Answers

0
votes

If I understand you correctly your problem is that you have a complicated query in the mainform and want to open a second form to update one underlying table of that query, then want to change the current record in the newly opened form and save it and then requery the original form? I understand you are a programmer, so the most versatile way to do this seems to me: Button on the mainform that opens the new form in modal modus with the correct record (that ensures that the rest of the original forms code executes after the modal form is closed), do your magic in the modal form, then requery the mainform.

Try something like this:

Private Sub myButton_Click()
  DoCmd.OpenForm "myEditForm", acNormal, , ID = 4, acFormEdit, acDialog
  me.requery
End Sub