sherlocked
Registered User.
- Local time
- Yesterday, 21:15
- Joined
- Sep 22, 2014
- Messages
- 125
Greetings Experts:
I am using the below SQL statement to pull a record from one database and insert it into another. I need to be able to update the column POBSort with one of three possible options based on the place of birth that's being displayed on a user subform.
I have done some Googling and found a few suggestions about using the Switch function or writing a module and calling it from within the query but the syntax of those things evade me.
Here is my sql statement:
Any ideas as to how I can get this query to look at the POB field and apply a CASE statement to update a different field in the destination table based on it's value?
Hope this is as clear as mud. Thanks in advance
I am using the below SQL statement to pull a record from one database and insert it into another. I need to be able to update the column POBSort with one of three possible options based on the place of birth that's being displayed on a user subform.
I have done some Googling and found a few suggestions about using the Switch function or writing a module and calling it from within the query but the syntax of those things evade me.
Here is my sql statement:
Code:
DoCmd.RunSQL "INSERT INTO tblRecords ( AppNo, AppType, FName, MI, LName, DOB, POB, MailAdd, MailCity, MailState, MailZip, Source, ExecMonth, ExecYear, ExecDate ) " _
& "IN 'MYURLTOMYDATABASE' " _
& "SELECT tblAppData.AppNo, tblAppData.AppType, tblAppData.FName, tblAppData.MI, tblAppData.LName, tblAppData.DOB, tblAppData.POB, " _
& "tblAppData.MailAdd, tblAppData.MailCity, tblAppData.MailState, tblAppData.MailZip, 'DS Referral' AS Expr1, DatePart('m',[ExecDate]) AS Expr2, " _
& "Format([ExecDate],'yyyy') AS Expr3, tblAppData.ExecDate, " _
& "FROM tblAppData " _
& "GROUP BY tblAppData.AppNo, tblAppData.AppType, tblAppData.FName, tblAppData.MI, tblAppData.LName, tblAppData.DOB, tblAppData.POB, " _
& "tblAppData.MailAdd, tblAppData.MailCity, tblAppData.MailState, tblAppData.MailZip, 'DS Referral', " _
& "DatePart('m',[ExecDate]), Format([ExecDate],'yyyy'), tblAppData.ExecDate, " _
& "HAVING (((tblAppData.AppNo)= '" & Form_frmStatusUpdate.frmUpdateCaseData.Form.AppNo & "'))"
Any ideas as to how I can get this query to look at the POB field and apply a CASE statement to update a different field in the destination table based on it's value?
Hope this is as clear as mud. Thanks in advance
