Wrox Home  
Search P2P Archive for: Go

  Return to Index  

access thread: SQL string problem


Message #1 by "wambui njoroge" <kagdw189@b...> on Thu, 19 Dec 2002 20:18:01
Hi all,

I have 2 sql string statements and I am using the Docmd.runsql command to
run them. The first one does not execute and neither does it give an error
message. The second string works fine. 

Does anybody know what the problem is?

Here's the code. The first one has the problem.

strAppAcad = "INSERT INTO ApplicantsAcademicInfo ( ApplicantID, PaidFee,
TermCode," & _
    " EntryDate,SO, Major, UnivID, MSUnivID, Transcript, LR1, LR2, LR3,
LR4, GREV," & _
    " GREVp, GREQ,GREQp, GREA, GREAp, GREAW, GREAWp, TOEFL, TOEFLRequired,
TOEFLDate," & _
    " GPA, MSGPA,DegSought, GASought, Complete, Location, Comments, Status,
GA, Coming," & _
    " YearsExp,Inquirer, PermanentStreetAddress, City, [State/Province],
PostalCode," & _
    " ResearchArea1,ResearchArea2, SupportAmount, CEF )" & _
    " SELECT ApplicantID, PaidFee, TermCode, EntryDate , SO, Major," & _
    " UnivID , MSUnivID, Transcript,LR1 , LR2, LR3, LR4,GREV , GREVp,
GREQ,GREQp , GREA," & _
    " GREAp,GREAW , GREAWp, TOEFL,TOEFLRequired , TOEFLDate, GPA,MSGPA ,
DegSought," & _
    " GASought,Complete , Location, Comments,Status , GA, Coming,YearsExp
," & _
    " Inquirer,PermanentStreetAddress , City, [State/Province] , PostalCode
," & _
    " ResearchArea1, ResearchArea2, SupportAmount , CEF " & _
    " FROM ArchivedAcademic" & _
    " WHERE SSN= '" & Forms![frm_Archive_Retrieve]![txtID] & "' ;"

DoCmd.SetWarnings False  'turns off system alert messages

DoCmd.RunSQL (strAppAcad) 


This one works:

strAppPer = "INSERT INTO ApplicantsPersonalInfo ( ApplicantID,
OldApplicantID," & _
    " FirstName, LastName, MI, Address, LocalStreetAddress, City,
[State/Province]," & _
    " PostalCode, Country, Email, Birthdate, USCitizen, LiveInUS, Gender,
SSN )" & _
    " SELECT ApplicantID, OldApplicantID, FirstName, LastName, MI,
Address," & _
    " LocalStreetAddress, City, [State/Province], PostalCode, Country,
Email," & _
    " Birthdate, USCitizen, LiveInUS, Gender, SSN" & _
    " FROM ArchivedPersonal" & _
    " WHERE SSN='" & Forms![frm_Archive_Retrieve]![txtID] & "' ;"


DoCmd.RunSQL (strAppPer)
Message #2 by "Haslett, Andrew" <andrew.haslett@i...> on Fri, 20 Dec 2002 10:42:07 +1030
First thing is to turn comment out this line:

    'Docmd.setwarnings False

At least you'll be able to see what is happening.

Also might pay to add this before you execute:

    debug.print strAppAcad

so you can see what you are actually trying to execute.

Cheers,
Andrew

-----Original Message-----
From: wambui njoroge [mailto:kagdw189@b...]
Sent: Friday, 20 December 2002 6:48 AM
To: Access
Subject: [access] SQL string problem


Hi all,

I have 2 sql string statements and I am using the Docmd.runsql command to
run them. The first one does not execute and neither does it give an error
message. The second string works fine. 

Does anybody know what the problem is?

Here's the code. The first one has the problem.

strAppAcad = "INSERT INTO ApplicantsAcademicInfo ( ApplicantID, PaidFee,
TermCode," & _
    " EntryDate,SO, Major, UnivID, MSUnivID, Transcript, LR1, LR2, LR3,
LR4, GREV," & _
    " GREVp, GREQ,GREQp, GREA, GREAp, GREAW, GREAWp, TOEFL, TOEFLRequired,
TOEFLDate," & _
    " GPA, MSGPA,DegSought, GASought, Complete, Location, Comments, Status,
GA, Coming," & _
    " YearsExp,Inquirer, PermanentStreetAddress, City, [State/Province],
PostalCode," & _
    " ResearchArea1,ResearchArea2, SupportAmount, CEF )" & _
    " SELECT ApplicantID, PaidFee, TermCode, EntryDate , SO, Major," & _
    " UnivID , MSUnivID, Transcript,LR1 , LR2, LR3, LR4,GREV , GREVp,
GREQ,GREQp , GREA," & _
    " GREAp,GREAW , GREAWp, TOEFL,TOEFLRequired , TOEFLDate, GPA,MSGPA ,
DegSought," & _
    " GASought,Complete , Location, Comments,Status , GA, Coming,YearsExp
," & _
    " Inquirer,PermanentStreetAddress , City, [State/Province] , PostalCode
," & _
    " ResearchArea1, ResearchArea2, SupportAmount , CEF " & _
    " FROM ArchivedAcademic" & _
    " WHERE SSN= '" & Forms![frm_Archive_Retrieve]![txtID] & "' ;"

DoCmd.SetWarnings False  'turns off system alert messages

DoCmd.RunSQL (strAppAcad) 


This one works:

strAppPer = "INSERT INTO ApplicantsPersonalInfo ( ApplicantID,
OldApplicantID," & _
    " FirstName, LastName, MI, Address, LocalStreetAddress, City,
[State/Province]," & _
    " PostalCode, Country, Email, Birthdate, USCitizen, LiveInUS, Gender,
SSN )" & _
    " SELECT ApplicantID, OldApplicantID, FirstName, LastName, MI,
Address," & _
    " LocalStreetAddress, City, [State/Province], PostalCode, Country,
Email," & _
    " Birthdate, USCitizen, LiveInUS, Gender, SSN" & _
    " FROM ArchivedPersonal" & _
    " WHERE SSN='" & Forms![frm_Archive_Retrieve]![txtID] & "' ;"


DoCmd.RunSQL (strAppPer)

IMPORTANT - PLEASE READ ******************** 
This email and any files transmitted with it are confidential and may 
contain information protected by law from disclosure. 
If you have received this message in error, please notify the sender 
immediately and delete this email from your system. 
No warranty is given that this email or files, if attached to this 
email, are free from computer viruses or other defects. They 
are provided on the basis the user assumes all responsibility for 
loss, damage or consequence resulting directly or indirectly from 
their use, whether caused by the negligence of the sender or not.

  Return to Index