Refreshing Access form based on Sql table

  • I have two forms in MS Access aplication based on two SQL table. Here are the tables with field.

    Table : Gage - Gage_Id,Gage_Name,Date_Calibrated and Next_Due_Date

           Calibration- Gage_Id(Link to Gage Gage_Id), Calibration_Id,Date_Calibratedand Next_Cal_Date,Status

    I have one form based on Gage table which carried gage info. It has calibration button on it,which open calibration form (leave gage form open on the bottom). After i finish calibration entry as soon as i select status "Pass" it run the update query which update Gage table with date_calibrated and next_due_date from calibration form. On close calibration form i have macro which refresh the record.

     Here is my question: It won't show me data for those updated fields. I went to sql server and updated data were ther. I have to close the form and came back to that record and then i can see new data. I just  find out i am linking those sql table to i have to close and relink so it retrive the data from server.

    Is there any other way that as soon as i say status pass then relink those table and without closeing and re-open gage form it show me the updated table.

  • Hello Dhaval,

    RE: "On close calibration form i have macro which refresh the record."

    The correct method is ".Requery" (which gets all data from the DB), not ".Refresh" (which re-calculates but doesn't get new or updated records.)

    In the close routine for Form_calibration, you can give VBA command:

      Form_gage.Requery

    Alternatively, you can define a routine to handle the Activate event in Form_gage, and issue the command Me.Requery there.  This second alternative is useful if the underlying data can be change by many other forms in the app.


    Regards,

    Bob Monahon

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply