Need to Refresh form From Button

G

Guest

I have an access application with a SQL server back-end database. The main
form is called GCPP Modifications Entry Form. We store screen shots relating
to some modifications, however, because of the time it took to load each
record we decided to add a button that would open the screen shots subform
only when needed (to add or view existing screen shots).

Because the of the SQL server back end the primary key is not assigned when
you open a new record, only after a refresh (such as navigating to a new
record). This means that if you are entering a modification and want to add
a related screen shot, when you press the screen shot button, the foreign key
assigned to the screen shot record will be <null>.

I would like to add a line to the macro for the button that opens the screen
shot form so that the main form is refreshed when the button is pressed. The
button currently uses a macro rather than expression. I have not been able
to figure out how to do this. I tried adding a line to the macro with a
requery command... the refresh command is not available in the macro builder.
I also tried adding a "me.refresh" expression on the on-click event (perhaps
because it was trying to refresh the button rather than the form??) rather
than using a macro- again to no avail.

Any suggestions?
 
M

Mark A. Sam

I don't believe that refreshing the form will help. I'm going to take a
guess on how you can solve this. I don't have time to test it, but I
suggest that instead of opening a new record through Access, that you create
a new record using code (DAO AddNew method) capure the ID in a variable,
requery the recordset, then use the FindFirst method to go to that record.

God Bless,

Mark A. Sam
 
G

Guest

Hi I would like to clarify what I wrote below. Please see clarifications in
all caps.

I have an access application with a SQL server back-end database. The main
 

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