Date from UserForm as input to SQL Query

444
1
06-06-2013 11:53 AM
BrianBaldwin1
New Contributor III
I am just wondering how to place the values from my userform into the IQueryDescription SQL code.  I know this is a pretty entry question, but am just held up at this last step.  Currently, the FM_DATE has hard values in it, but I want to replace these with the TimeStart and TimeEnd userform input.

 
Dim TimeStart As Date
Dim TimeEnd As Date

TimeStart = Me.Time1.Value
TimeEnd = Me.Time2.Value

        Dim queryDescription As IQueryDescription = sqlWorkspace.GetQueryDescription("SELECT DCS_Fact.FM_DATE FROM DCS_Fact INNER JOIN TIBURON.INMAST ON DCS_Fact.DR = TIBURON.INMAST.IM_DR WHERE (DCS_Fact.FM_DATE >= '2012-01-01') AND (DCS_Fact.FM_DATE <= '2012-12-31')")
        Dim queryClass As ITable = sqlWorkspace.OpenQueryClass("Parcels", queryDescription)
0 Kudos
1 Reply
BrianBaldwin1
New Contributor III
Looks like I just had to read in my old Getting to Know Arc Objects for 5 Seconds...

Just had to split the string where the date was and insert " & TimeStart & "
0 Kudos