• WSRNCIENG

    WSRNCIENG

    @wsrncieng

    Viewing 15 replies - 31 through 45 (of 445 total)
    Author
    Replies
    • in reply to: INSERT INTO syntax (A2K3) #1141722

      Thanks Hans.

    • in reply to: Pass a parameter to a query via code (A2K3) #1140879

      Hans,

      You always provide excellent and effecient solutions and I just can’t thank you enough. Sincerely.

      I had to make a minor change to the code because txtStart and txtEnd didn’t change no matter the selection. In case anyone needs this in the future, the change I made is below.

      Original:
      Me.txtStart = DateSerial(Year(Date), 3 * i – 2, 1)
      Me.txtEnd = DateSerial(Year(Date), 3 * i + 1, 0)
      Change:
      Me.txtStart = DateSerial(Year(Date), 3 * Lo – 2, 1)
      Me.txtEnd = DateSerial(Year(Date), 3 * Hi + 1, 0)

    • in reply to: Pass a parameter to a query via code (A2K3) #1140866

      Yes….right as always

    • in reply to: Pass a parameter to a query via code (A2K3) #1140864

      Thanks again Hans…..

      Now, can I ask yet another question, please?

      Taking the scenerio I’ve outlined in this thread and on the code you’ve provided, is there an effecient way to determine the following:

      Determine the FIRST Date of the first selected quarter (i) and the LAST date of the last selected quarter selected (i)? i.e. Let’s assume the user selected opt1 and opt2 (1st and 2nd quarter), txtBegin would be 1/1/CurrentYear and txtEnd would be 5/31/CurrentYear?

      If the user selected opt2, opt3 and opt4 (2nd, 3rd and 4th quarter) then the txtBegin would be 4/1/CurrentYear and txtEnd would be 12/31/CurrentYear.

    • in reply to: Pass a parameter to a query via code (A2K3) #1140715

      BEAUTIFUL…..Oh thank you Hans.

      What if I wanted to include another checkbox (opt5) and title it “QTD” to pull all current quarters for the year? Would I change For i = 1 To 4 to For i = 1 To 5 and change this strIn = “Qtr In (” & Mid(strIn, 3) & “)” to strIn = “Qtr In (” & Mid(strIn, 4) & “)”?

    • in reply to: Pass a parameter to a query via code (A2K3) #1140698

      Good Afternoon,

      I have 4 option buttons, opt1, opt2, opt3, and opt4. Each option button represents the Qtr. The user may want to view a report based on a specific QTR so by selecting the qtr (option button) they want then the value needs to be passed to a query.

      I’m not sure on how to build the logic to capture which option (and they can select more than 1) the user selected and I don’t know how to pass that value to the query.

      I have the query built, I have the report built, I just need to pass the user’s request to the query.

      For instance.

      if user selects option 2 and 3, I need to pass “2 and 3” as a criteria to the query to only pull the data for 2nd and 3rd quarter.
      if user selects option 4, I need to pass “4” as a criteria to the query to only pull the data for 4th quarter.

      Can someone please point me in the right direction.

    • in reply to: MATCH, INDEX, OFFSET (A2K3) #1136055

      Yes it does…thank you very much.

    • in reply to: ConnectionString (A2K3) #1133267

      I resolved the problem. See code.

      [indent]


      Long piece of code moved to attachment by HansV


      [/indent]

      I moved the table to another db on the server and everything went fine. Thanks Hans for your assistance, as always, it’s appreciated.

    • in reply to: ConnectionString (A2K3) #1133256

      Hans,

      I changed the code as suggested to:

      [indent]


      connectionString = “ODBC;DRIVER={SQL Server}” _
      + “;SERVER=” & “KMHPSQLKY20” _
      + “;DATABASE=” + SrcDatabaseName + “;”


      [/indent]

      but get the same error. Oddly, I can put the table in a query, see all the fields but when I go to run the query, I get the same message.

    • in reply to: DateSerial (A2K3) #1131772

      I think I have it.

      [indent]


      Between DateSerial(Year(Date())-1,Month(Date())-2,1) And DateSerial(Year(Date())-1,Month(Date())-1,0)


      [/indent]

      If anyone knows of a more effecient way, please let me know.

    • in reply to: Update Syntax (A2K3) #1130670

      Thanks Hans, that’s what was missing. I knew to put the pound sign in, but was putting the last one in in the wrong place.

    • in reply to: mySQL (A2K3) #1130594

      Hans,

      I believe I’ve resolved it. See below:

      [indent]


      Dim db As DAO.Database
      Dim tdf As DAO.TableDef
      Dim rst As DAO.Recordset
      Dim mySQL As String

      mySQL = “SELECT tEmail.EmailAddy ” & _
      “INTO tblTemp ” & _
      “FROM tEmail ” & _
      “WHERE Send=True;”

      DoCmd.SetWarnings False
      DoCmd.RunSQL mySQL
      DoCmd.SetWarnings True

      Set db = CurrentDb()
      Set tdf = db.TableDefs(“tblTemp”)
      Set rst = db.OpenRecordset(“tblTemp”, dbOpenTable)


      [/indent]

      Thanks for the assistance.

    • in reply to: mySQL (A2K3) #1130586

      I’ve tried that several times earlier but thinking I missed something I tried your suggestion again and still I get the following error msg.

      [indent]


      Run-Time error 2342

      a RunSQL action requires an argument consisting on an SQL statement


      [/indent]

    • in reply to: Sequential Numbering (A2K3) #1126092

      I got it Hans, as always, thanks so much for your help

    • in reply to: Sequential Numbering (A2K3) #1126088

      Ok…I’ve modified you suggestion as you said to and it provides me with the count but the count appears like it was a totals query rather than a select query. i.e.

      123456789 5
      987654321 3

      I need each record to appear with the count next to it.

      123456789 1
      123456789 2
      123456789 3
      123456789 4
      123456789 5

      987654321 1
      987654321 2
      987654321 3

    Viewing 15 replies - 31 through 45 (of 445 total)