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

SQL coding question

Status
Not open for further replies.

ViperD

IS-IT--Management
May 1, 2003
27
US
I'm trying to write a sql statement. What I am trying to do is run a query when a field loses focus on a form. This field is in a subform. In my sql below, PatientSS# is the name of a TextBox.

DoCmd.RunSQL ("Select Claim_Type,Primary_Pymt from Tests where PatientSS#=" & PatientSS#)

I also want to know how I would assign the results of the query to an array.
 
If you're running a select statement, I assume you want to look at the data. Do not use RunSQL, use CurrentDB.OpenRecordset(), or CurrentDB.Execute(), depending on whether you plan on using ADO or DAO recordsets.

Also, you will not be able to assign the query results to an array except for the hard way: row by row.

--
Find common answers using Google Groups:

Corrupt MDBs FAQ
 
I will want to look at the data while coding, but when the coding is finished, I will not need to seed the data. But the code will still need to run the select statement to get the data.
 
I guess I should clarify my first post. VBA does not like my SQL statement. It tells me that there is a syntax error in date in query expression 'PatientSS#=0'. So I guess I need to know how I can reference a field on a form from within a subform on that form.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top