Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Two different Jet Objects in a form

Status
Not open for further replies.

Xzibit7

Technical User
Jun 20, 2006
172
US
I have subform that is based on a passthru query and a click command that takes you to another form based on information from mutiple tables in a seperate odbc database than the subform. The problem is when I erase the subform from the form the username password screen comes up for the outside database like it should. But when I have the passthru query (which gets its data from a seperate odbc machine source) on the form I get an error that says "The Microsoft jet engine could not find the object". Now I have set the properties on the passthru query to time out odbc after 1 seconds and to store the password and I still get the message. Can I just not have these two items on the same form?
 
Okay I just changed both queries to be based on passthru queries. I think the problem is that on one form I have different logins for two different passthru queries. Does this sound right?
 
This is really strange if I put both procedures in the same vb code event, then it works.

Private Sub Command3_Click()
Dim db As DAO.Database
Dim qd As DAO.QueryDef
Dim q1 As DAO.QueryDef
Dim q2 As DAO.QueryDef
Dim q3 As DAO.QueryDef
Dim q4 As DAO.QueryDef
Dim q5 As DAO.QueryDef
Dim ve As DAO.QueryDef



Set db = CurrentDb
Set qd = db.QueryDefs("ZDOR_ITM")
Set q1 = db.QueryDefs("BOF_CURR")
Set q2 = db.QueryDefs("DUE_CURR")
Set q3 = db.QueryDefs("ZDOR_ACF")
Set q4 = db.QueryDefs("STK_BUY")
Set q5 = db.QueryDefs("ZDOR_WSP")
Set ve = db.QueryDefs("VEtrack")

DoCmd.SetWarnings False



ve.SQL = "SELECT * FROM VETRACK.PROJECT@dscr_css " & _
"WHERE NIIN IN ('" & _
Me.NIIN & "')"


q5.SQL = "SELECT * FROM DSS_USER.V_Portal_ZDOR_WSP " & _
"WHERE NIIN IN ('" & _
Me.NIIN & "')"
DoCmd.OpenQuery "Get_WSP_INfo"

qd.SQL = "SELECT * FROM DSS_USER.V_Portal_ZDOR_ITM " & _
"WHERE NIIN IN ('" & _
Me.NIIN & "')"
DoCmd.OpenQuery "Get_ITM (MM data)"

q1.SQL = "SELECT * FROM DSS_USER.V_Portal_ZDOR_BOF_CURR " & _
"WHERE NIIN IN ('" & _
Me.NIIN & "')"
DoCmd.OpenQuery "Get_BO"

q2.SQL = "SELECT * FROM DSS_USER.V_Portal_ZDOR_DUE_CURR " & _
"WHERE NIIN IN ('" & _
Me.NIIN & "')"
DoCmd.OpenQuery "Get_Due_Curr"

q3.SQL = "SELECT * FROM DSS_USER.V_Portal_ZDOR_ACF " & _
"WHERE NIIN IN ('" & _
Me.NIIN & "')"
DoCmd.OpenQuery "Get_Purch_Info"

q4.SQL = "SELECT * FROM DSS_USER.STK_BUY_HIST " & _
"WHERE NIIN IN ('" & _
Me.NIIN & "')"
DoCmd.OpenQuery "Get_Purch_Info_Samms"
DoCmd.SetWarnings False
DoCmd.OpenReport "Data Mining Report", AcView.acViewPreview

DoCmd.SetWarnings True
End Sub

But if they are in seperate event commands on the same form I get the cant find odbc table weird huh. The ve.sql is the one that is seperated and needs to be because it is different data. So now I have it all on one commands click.
The problem with that is if a user clicks the other command it gives me the value of the last niin and not the newly queried one. Also it would be nice to have this on the forms open but that would take to long because the one query(not the ve one but everything else) takes a few minutes to get the data(lotta stuff) This is a problem becuase the form also has commands to link to outside web pages with the NIIN's information. Any suggestions?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top