Requerying with Vba


Hi All, just got a small problem. I have a form (For Albums), that the user will enter data in. At the bottom of the form is a button that takes them to another table, which allows them to enter Songs on the album. My only problem is that when the button is clicked, the table that stores the data for the Albums is not refreshed, so when the user goes to enter data in the songs form, and wants to enter the album which the song is on, the Album does not appear. To open the song form, I am using a button with this code; DoCmd.OpenForm "Band", , , , acFormAdd
I was thinking that when that button is pressed, or when the song form is loaded, the album table could be requeried, as well as the field which asks for the album in the song table (Album_ID). I would think that would solve my problem, as after the album data has been entered, the table would refresh and would be available when entering song data. Thanks

2 Replies



Try to save the new album record by inserting this line above the DoCmd.Openform:

If Me.Dirty = True Then Me.Dirty = False


Access News (new March episode)
Access DevCon (April 28+29)


Hi Karl, Just wondering, If a user enters two albums, then goes back to the first album, clicks this button with the above code, I noticed that the second album will not save yet. I guess this won't really be a problem for the user, it just could be a little confusing. I did notice that closing the form will save all records, but that creates the problem where when I want to reopen the Album form from the Song form, to the same Album, it will not. I think I will stick with the code you have provided. Thank you!