Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Modules / DAO / VBA / March 2005

Tip: Looking for answers? Try searching our database.

Pass query results to form

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
smk23 - 04 Mar 2005 20:41 GMT
My brain froze up on me...

What is the best way to pass a value from a SQL query back to my form?
I am doing a LookUp of a value in a table based on a couple of parameters
passed into the query. THis is a SQL statement passing to SQL server 2k and
only one record matches the criteria. THe SQL statement is fine (tested as a
pass-through). But I blanking on how to capture the output value and use that
in the form.

Signature

sam

sparker - 04 Mar 2005 20:49 GMT
declare a variable
assign the variable your aquired value from your query
pass the value of the newly aquired variable to your object
such as  a textbox:

Dim strMyVar As String
strMyVar = 'results from query
txtMyTextBox.setfocus
txtMyTextBox.text = strMyVar

> My brain froze up on me...
>
[quoted text clipped - 4 lines]
> pass-through). But I blanking on how to capture the output value and use that
> in the form.
smk23 - 04 Mar 2005 21:27 GMT
Hey thanks, Sparker.
What is wrong with this syntax:
rst is properly declared and the query has a record. It just doesn't like
the second line.

Set rst = CurrentDb.OpenRecordset("rqTumStg")

Me.omg_ClinStage = rst.TumorStage

TIA,
Sam

> declare a variable
> assign the variable your aquired value from your query
[quoted text clipped - 14 lines]
> > pass-through). But I blanking on how to capture the output value and use that
> > in the form.
Steve Schapel - 05 Mar 2005 03:26 GMT
Sam

Try with a ! instead of a . as in...
 Me.omg_ClinStage = rst!TumorStage

Signature

Steve Schapel, Microsoft Access MVP

> Hey thanks, Sparker.
> What is wrong with this syntax:
[quoted text clipped - 7 lines]
> TIA,
> Sam
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.