Hello All.
I'm (attempting) to put together a macro will reference a "start date" cell and an "end date" cell. The macro will contain SQL that will hit a sybase database and extract the needed info. Here is my problem. All the dates in the sybase DB are stored in UK format (yyyy-mm-dd). I've formated the 2 cells to this format, the macro is still seeing them in the windows fromat (mm/dd/yyyy). Now I know if I go into control panel and change the format to the UK format my macro works.
QUESTION: Is there something I can do in the macro so that I can get the UK date format and the US format date to work correctly, some type of conversion code would be great.
If it helps, here is the SQL code that I'm using:
select distinct n.statdate, a.lastname+','+a.firstname, q.primaryagent, q.sharepct, p.policyid, c.lastname+','+c.firstname, p.plantype, l.basicface, p.annprem, p.targetprem, p.fyc, p.premmode, p.ex1035prem, p.stat, a.gano, n.Status from dba.policy p, dba.nbapphistory n, dba.polagent q, dba.life l, dba.contact a, dba.contact c, dba.ltc m where (n.StatDate>=? And N.StatDate<=?)and (n.status = '93' or n.status = 18) and n.policyno = p.policyno and n.policyno = q.policyno and n.policyno *= l.policyno and q.agentno = a.clientno and p.clientno = c.clientno order by a.gano,p.policyid, p.stat
(the section : "(n.StatDate>=? And N.StatDate<=?)" is generating a prompt for the date. This is sort of working, but the requirements that I have specify that the dates should be in cells, and the macro pulls from those cells)
Thanks to all
I'm (attempting) to put together a macro will reference a "start date" cell and an "end date" cell. The macro will contain SQL that will hit a sybase database and extract the needed info. Here is my problem. All the dates in the sybase DB are stored in UK format (yyyy-mm-dd). I've formated the 2 cells to this format, the macro is still seeing them in the windows fromat (mm/dd/yyyy). Now I know if I go into control panel and change the format to the UK format my macro works.
QUESTION: Is there something I can do in the macro so that I can get the UK date format and the US format date to work correctly, some type of conversion code would be great.
If it helps, here is the SQL code that I'm using:
select distinct n.statdate, a.lastname+','+a.firstname, q.primaryagent, q.sharepct, p.policyid, c.lastname+','+c.firstname, p.plantype, l.basicface, p.annprem, p.targetprem, p.fyc, p.premmode, p.ex1035prem, p.stat, a.gano, n.Status from dba.policy p, dba.nbapphistory n, dba.polagent q, dba.life l, dba.contact a, dba.contact c, dba.ltc m where (n.StatDate>=? And N.StatDate<=?)and (n.status = '93' or n.status = 18) and n.policyno = p.policyno and n.policyno = q.policyno and n.policyno *= l.policyno and q.agentno = a.clientno and p.clientno = c.clientno order by a.gano,p.policyid, p.stat
(the section : "(n.StatDate>=? And N.StatDate<=?)" is generating a prompt for the date. This is sort of working, but the requirements that I have specify that the dates should be in cells, and the macro pulls from those cells)
Thanks to all