We help IT Professionals succeed at work.
Get Started

The code shows nothing when run

simflex asked
Last Modified: 2008-07-11
Greetings all,

I would love to enlist your assistance with this problem.

I have 2 tables, parent table and dependent table.

Once a record is stored in the db, I would like to use the code below to retrieve records from both tables.

I am using a sub but when I run the code, it does not do anything at all. No errors, nothing.

Please see what I am doing wrong.

Please see attached code and someone is helping me with it but apparently got very busy and has been unable to continue offering help.

Thanks in advance
Dim conn, curRS, familyRS, depRS
Set familyRS = Nothing ' family recordset
Set depRS = Nothing ' dependent(s) recordset
Sub getDataFor(email)
Set conn = Server.CreateObject("ADODB.Connection")
conn.Open "PROVIDER=Microsoft.Jet.OLEDB.4.0;DATA SOURCE=" & server.mappath("Database/Family.mdb")
Set familyRS = "SELECT * FROM parentsTable WHERE familyemail = '" & Replace(email,"'","''") & "'"
If familyRS.EOF Then
Reponse.Write "No such email found in parentsTable: " & email
End If
' found family, now find all dependents for that family
familyID = curRS("parentID") ' or whatever the field name is that links the two tables
Set depRS = "SELECT * FROM dependentsTable WHERE parentID = " & familyID
End Sub
' the pXXX functions are "printableTxt", etc.
' That is, *if* there is available data from the recordset then a printable
' response is returned from the function, for use in building the <FORM>
Function pTxt(name)
If curRS Is Nothing Then
pTxt = ""
pTxt = curRS(name)
End If
End Function
Function pChk(name)
If curRS Is Nothing Then
pChk = ""
If CBool( curRS(name) ) Then pChk=" CHECKED " Else pChk=""
End If
End Function
Function pRadio(name,val)
If curRS Is Nothing Then
pRadio = ""
If LCase(curRS(name)) = LCase(val) Then pRadio=" CHECKED " Else pRadio=""
End If
End Function
states = Array("AL:Alabama","AK:Alaska","AZ:Arizona","AR:Arkansas","CA:California","CO:Colorado","CT:Connecticut","DE:Delaware","FL:Florida","GA:Georgia","HI:Hawaii","ID:Idaho","IL:Illinois","IN:Indiana","IA:Iowa","KS:Kansas","KY:Kentucky","LA:Louisiana","ME:Maine","MD:Maryland","MA:Massachusetts","MI:Michigan","MN:Minnesota","MS:Mississippi","MO:Missouri","MT:Montana","NE:Nebraska","NV:Nevada","NH:New Hampshire","NJ:New Jersey","NM:New Mexico","NY:New York","Non-US:Non-US","NC:North Carolina","ND:North Dakota","OH:Ohio","OK:Oklahoma","OR:Oregon","PA:Pennsylvania","RI:Rhode Island","SC:South Carolina","SD:South Dakota","TN:Tennessee","TX:Texas","UT:Utah","VT:Vermont","VA:Virginia","WA:Washington","DC:Washington D.C.","WV:West Virginia","WI:Wisconsin","WY:Wyoming")
' to get things started, we copy the family recordset to the "current" recordset:
Set curRS = familyRS
This is just a snippet

Open in new window

Watch Question
This problem has been solved!
Unlock 1 Answer and 15 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE