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 Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

get value from passthru query

Status
Not open for further replies.

AT76

Technical User
Apr 14, 2005
460
US
I'm trying to get a value from a pass thru query into a form. Below is an example:

Code:
Set qdfEXAMPLE= dbCurrent.CreateQueryDef("PT:TEST")
qdfEXAMPLE.Name = "PT:TEST"
qdfEXAMPLE.Connect = "ODBC;DSN=DSN_NAME"
qdfEXAMPLE.ReturnsRecords = True

qdfEXAMPLE.SQL = "SELECT ITEM1, ITEM2, ITEM3, ITEM4 " _
        & "WHERE ITEM1 = '" & [Forms]![FRM_Main]![TEXT1] & "'"

Dim txtHere as string
txtHere = ITEM2

Unfortunately the value of Item2 doesn't get passed. The weird thing is that I'm able to vie the Pass Thru query. Any suggestions? Thanks!
 
I got it now:
Set rstEXP = qdfEXAMPLE.OpenRecordset(dbOpenSnapshot)
Me.txtHere = rstEXP!ITEM2

Thanks!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top