Refreshing data in a list

F

freedomverse

I have a supposedly easy question but I am having trouble with the answer.

I have a sub form named "songsdetail" that has a button that opens the
"song" form so that I can add new songs to the song list. This works great.
When I return to the "songsdetail" form the new song doesn't show up in the
combo box "SongTitle" until I press F9 or the "refresh all" button. Is there
a way to make it update the list automatically? I must be misunderstanding
something in the help file as I have had no success.

Cheers,
Jared.
 
F

freedomverse

Thank you. Where do I enter that line, Me.SongTitle.Requery? I had tried
something similar in visual basic in the "on got focus" -- but this doesn't
seem to be the correct place.

Thanks,
Jared.
 
F

freedomverse

I tried putting the code you recommended:

Me.SongTitle.Requery

It gave me an error and opened the debugger. I placed the command on it's
own line after the openform line and I also tried to put it after the
gotorecord line.

Basically the "Command96" button is the one that opens the "Song" form.
There I add a new song and close that form. When I get back my main form I
want the combo box to requery so that it will include the new song that I
have just entered.

Here is my code:

Private Sub Command96_Click()
On Error GoTo Command96_Click_Err

DoCmd.OpenForm "Song"
DoCmd.GoToRecord , "", acNewRec


Command96_Click_Exit:
Exit Sub

Command96_Click_Err:
MsgBox Error$
Resume Command96_Click_Exit
 
F

freedomverse

I realize that I wouldn't last a day in the 'real world' doing this sort of
stuff but when working on a project for your church you find yourself wearing
hats that you may not have ever known existed. So, yes, I am uneducated and
have learned access mostly by the "dummies" book and the access help file. I
have put together a pretty cool database so far without the need of any
knowledge of 'code' but to do these final touches I find myself needing to
know a bit. I could be 'done' without them but with them it will be a much
more user friendly database. I will be on my way to the store / or library
soon to get a book about Visual Basic but until then.... back to my issue at
hand:

When I put in the code you recommended I get a compile error on the
Me.SongTitle.Requery line. Taking this line out removes the error but makes
another problem: The "Song" from no longer goes to a new record and upon
return to the main form IT goes to a new record, no good. I have spent an
hour trying to find out how to write the code more specifically so that I get
what I want but so far am still stuck. In short, here is what I want:

1. Pressing the button (located on the subform called "SongsDetail") would
bring me to the "Songs" form and display a new record.
2. There I can enter a new song in the list and close that form.
3. Upon Returning to the main form I want the field called "SongTitle" that
is located in the subform "SongsDetail" to include the new song that I just
entered
4. I want to then smile because it all works great!

I do very much appreciate your help if you are still willing to put up with
my inexperience.

Regards,
Jared.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top