Not getting data from form.

G

Guest

I have a form that I use to set a Query that feeds a form. If I open the from
and set the data and leave the form open and then open the 2nd form it works.
I would like to use a cmd_btn that will close the first form and feed the
query. Bellow is the the code that I have on the btn.

Dim stDocName As String
Dim stLinkCriteria As String
Dim stDocName2 As String


stDocName = "IAPWS_Fm"
stDocName2 = "IAPWS_LookUp"

DoCmd.Close acForm, stDocName2, acSaveYes

DoCmd.OpenForm stDocName, , , stLinkCriteria

Exit_Command21_Click:
Exit Sub

Err_Command21_Click:
MsgBox Err.Description
Resume Exit_Command21_Click
 
F

fredg

I have a form that I use to set a Query that feeds a form. If I open the from
and set the data and leave the form open and then open the 2nd form it works.
I would like to use a cmd_btn that will close the first form and feed the
query. Bellow is the the code that I have on the btn.

Dim stDocName As String
Dim stLinkCriteria As String
Dim stDocName2 As String


stDocName = "IAPWS_Fm"
stDocName2 = "IAPWS_LookUp"

DoCmd.Close acForm, stDocName2, acSaveYes

DoCmd.OpenForm stDocName, , , stLinkCriteria

Exit_Command21_Click:
Exit Sub

Err_Command21_Click:
MsgBox Err.Description
Resume Exit_Command21_Click

Feed what query?
All I see here is one form opening the other... without any criteria.
Reverse the 2 lines.
Open the second form then close the first.

DoCmd.OpenForm stDocName, , , stLinkCriteria
DoCmd.Close acForm, stDocName2, acSaveYes

Why acSaveYes? That saves design changes to the form.
 

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