Pass the value to DataSheetView

katekaew

Registered User.
Local time
Today, 07:01
Joined
Jan 19, 2005
Messages
19
How to pass the values from the first page to the second page? The first page contains the lists of Area_Code. After selecting the area_code and the button being clicked the second page automatically call the Query1 (where the area_code's Criteria is Forms!MainForm!SubForm!txtAreaCode) and get the data back on the DataSheetView on the second page.

I found many people use the comboBox and AfterUpdate() to requery the data. But my case is different. Because on the first page, I have a list of area code which has the button to check the authorisation before continuing to the second page.

Thank you very much!
 
What is your definition of Page?
 
Page means Form. I tried to make an example to explain what I'm trying to do. Please see the attached.
 

Attachments

Last edited:
Kate, I have looked at your database and found a way to completely eliminate the button. I used the AfterUpdate event of the list box to trigger the open and closing of the frmForm. This allows the frmForm to open with the new records or changes that were made. Note that I changed the query being used for the datasource of your subform by adding the following to the criteria [Forms]![frmAreas]![ListAreas], this allows the query to receive the value from the listbox without having to specify it through code using the criteria. I have attached a working modified database. Note that the code you had on the database you posted was crashing my access program, the lines affecting it were on the On Current Event of the form, so I took them out.

Private Sub ListAreas_AfterUpdate()
DoCmd.Close acForm, "frmForm", acSaveYes
DoCmd.OpenForm "frmForm"
End Sub
 

Attachments

Users who are viewing this thread

Back
Top Bottom