Results 1 to 3 of 3
  1. #1
    Silver Lounger GARYPSWANSON's Avatar
    Join Date
    Aug 2001
    Location
    Frederick, Maryland, USA
    Posts
    1,788
    Thanks
    0
    Thanked 2 Times in 2 Posts

    Coding Help - Make Table Query (A2K SR1)

    The below Make Table Query works. However, I want to be able to have the table name set equal to a selection from a Combo box on a form, not "AAAA" as shown. I can't seem to get the syntax correct. How would I code INTO [AAAA] to something like INTO ME.COMBOBOX.VALUE so it will work????

    (Note: I had a similar post regarding this yesterday where I indicated I had figured this out - the prior post has been deleted to avoid confusion.)

    '& "MSP_TASKS_SUBTABLE.TASK_IS_CRITICAL INTO [AAAA]" _


    'strSql = "SELECT MSP_TASKS_SUBTABLE.TASK_WBS AS CWBS, " _
    '& "MSP_TASKS_SUBTABLE.TASK_NAME AS Description, " _
    '& "Format([TASK_START_DATE],'mm/dd/yyyy') AS [Planned Start]," _
    '& "Format([TASK_FINISH_DATE],'mm/dd/yyyy') AS [Planned Finish]," _
    '& "Format([TASK_BASE_START],'mm/dd/yyyy') AS [Baseline Start]," _
    '& "Format([TASK_BASE_FINISH],'mm/dd/yyyy') AS [Baseline Finish]," _
    '& "MSP_TASKS_SUBTABLE.TASK_UID, MSP_TASKS_SUBTABLE.TASK_IS_MILESTONE," _
    '& "MSP_TASKS_SUBTABLE.TASK_IS_SUMMARY, MSP_TASKS_SUBTABLE.TASK_PCT_COMP AS [Percent Complete]," _
    '& "MSP_TASKS_SUBTABLE.TASK_IS_CRITICAL INTO [AAAA]" _
    '& "From MSP_TASKS_SUBTABLE " _
    '& "WHERE " _
    '& "(((MSP_TASKS_SUBTABLE.TASK_WBS)<>'' And " _
    '& "(MSP_TASKS_SUBTABLE.TASK_WBS)<>'C') AND " _
    '& "((MSP_TASKS_SUBTABLE.TASK_IS_SUMMARY)=No) AND " _
    '& "((MSP_TASKS_SUBTABLE.TASK_PCT_COMP)<>100) AND" _
    '& "((MSP_TASKS_SUBTABLE.TASK_IS_CRITICAL)=-1) AND" _
    '& "((Left([TASK_WBS],1))='C'));"
    Regards,

    Gary
    (It's been a while!)

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Coding Help - Make Table Query (A2K SR1)

    The reference to the combo box must be outside the quotes.

    & "MSP_TASKS_SUBTABLE.TASK_IS_CRITICAL INTO [" & Me.ComboBox.Value & "]" _

  3. #3
    Silver Lounger GARYPSWANSON's Avatar
    Join Date
    Aug 2001
    Location
    Frederick, Maryland, USA
    Posts
    1,788
    Thanks
    0
    Thanked 2 Times in 2 Posts

    Re: Coding Help - Make Table Query (A2K SR1)

    Thanks Hans,

    I had just got this to work as well with the following code:

    Dim tName As String
    tName = Me!Combo40.Value


    strSql = "SELECT MSP_TASKS_SUBTABLE.TASK_WBS AS CWBS, " _
    & "MSP_TASKS_SUBTABLE.TASK_NAME AS Description, " _
    & "Format([TASK_START_DATE],'mm/dd/yyyy') AS [Planned Start]," _
    & "Format([TASK_FINISH_DATE],'mm/dd/yyyy') AS [Planned Finish]," _
    & "Format([TASK_BASE_START],'mm/dd/yyyy') AS [Baseline Start]," _
    & "Format([TASK_BASE_FINISH],'mm/dd/yyyy') AS [Baseline Finish]," _
    & "MSP_TASKS_SUBTABLE.TASK_UID, MSP_TASKS_SUBTABLE.TASK_IS_MILESTONE," _
    & "MSP_TASKS_SUBTABLE.TASK_IS_SUMMARY, MSP_TASKS_SUBTABLE.TASK_PCT_COMP AS [Percent Complete]," _
    & "MSP_TASKS_SUBTABLE.TASK_IS_CRITICAL INTO [" & tName & "]" _
    Regards,

    Gary
    (It's been a while!)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •