UtterAccess.com
X   Site Message
(Message will auto close in 2 seconds)

Welcome to UtterAccess! Please ( Login   or   Register )

Custom Search
 
   Reply to this topicStart new topic
> Requery A Form, From Another Form With A Parameter Value, Access 2016    
 
   
ollyhutsy
post Oct 18 2019, 03:30 AM
Post#1



Posts: 64
Joined: 16-October 19



I am trying to requery a form from another pop up form. This is because the data you enter in the pop up form will change the status in the other form. I have tried a requery command in the AFTER UPDATE of the form i am trying to update. However this has not updated the data. I have used a requery command on an exit button of the pop form, which works fine. However the form asks me for a parameter value what it is getting from another form when opened. I was wondering if i could use a control source in the pop up form for the query parameter. I have found some code online however I do not quite understand it, and would appreciate some pointers.

Dim dbs As DAO.Database
Dim qdf As DAO.QueryDef

Set dbs = CurrentDb
Set qdf = dbs.QueryDefs("Turning Parts to Complete Query")

qdf.Parameters = Me.WO_No

qdf.Execute
qdf.Close

Set qdf = Nothing
Set dbs = Nothing

End Sub

The idea is to requery the query which is the forms data source, with the control source WO NO from the pop up form.

any suggestions?
Go to the top of the page
 
arnelgp
post Oct 18 2019, 03:57 AM
Post#2



Posts: 1,510
Joined: 2-April 09
From: somewhere out there...


you can change the Recordset of the Other form.
CODE
Dim dbs As DAO.Database
Dim qdf As DAO.QueryDef

Set dbs = CurrentDb
Set qdf = dbs.QueryDefs("Turning Parts to Complete Query")

qdf.Parameters(0) = Me.WO_No

Set Forms!theOtherFormName.Recordset = qdf.OpenRecordset(dbOpenDynaset)
qdf.Close

Set qdf = Nothing
Set dbs = Nothing

End Sub

--------------------
Never stop learning, because life never stops teaching.
Go to the top of the page
 
ollyhutsy
post Oct 18 2019, 04:16 AM
Post#3



Posts: 64
Joined: 16-October 19



Works a treat, Thanks.
Go to the top of the page
 
arnelgp
post Oct 18 2019, 04:24 AM
Post#4



Posts: 1,510
Joined: 2-April 09
From: somewhere out there...


you're welcome!

--------------------
Never stop learning, because life never stops teaching.
Go to the top of the page
 


Custom Search


RSSSearch   Top   Lo-Fi    20th November 2019 - 12:45 PM