none
error 3057 RRS feed

  • Question

  • A run time error tells me I have a syntax issue, but I cannot find it.  Can anyone help

    Here is the error dialog:

    here is my code:

    Private Sub Command6_Click()
    Dim strAccount As String
    Dim dtmFrom As Date
    Dim dtmTo As Date
    strAccount = Forms![Reconcile Dialog]![cboAccount]
    dtmFrom = Forms![Reconcile Dialog]!rngFromDate
    dtmTo = Forms![Reconcile Dialog]!rngToDate

    DoCmd.OpenForm "Reconcile", , , "[(From Account] = " & strAccount & " And [Entry Date] Between " & dtmFrom & " And " & dtmTo & """"

    DoCmd.Close acForm, "Reconcile Dialog"

    DoCmd.Close acForm, "Open Transactions List"

    please help and thank you.

    Monday, January 22, 2018 6:16 PM

Answers

  • DoCmd.OpenForm "Reconcile", , , "[(From Account] = " & strAccount & " And [Entry Date] Between " & dtmFrom & " And " & dtmTo & """"

    Hi NoviceVBAuser1775,

    You could try:

    DoCmd.OpenForm "Reconcile", , , "[From Account] = '" & strAccount & "' And [Entry Date] Between #" & dtmFrom & "# And #" & dtmTo & "#"

    Imb.



    • Edited by Imb-hb Monday, January 22, 2018 7:11 PM
    • Marked as answer by NoviceVBAuser1775 Tuesday, January 23, 2018 2:38 AM
    Monday, January 22, 2018 7:10 PM

All replies

  • First, Remove the ( in "[(From Account]=

    but you still might get an error if your " (double quotes) and/or ' (single quotes) are not correct.

    Monday, January 22, 2018 6:31 PM
  • DoCmd.OpenForm "Reconcile", , , "[(From Account] = " & strAccount & " And [Entry Date] Between " & dtmFrom & " And " & dtmTo & """"

    Hi NoviceVBAuser1775,

    You could try:

    DoCmd.OpenForm "Reconcile", , , "[From Account] = '" & strAccount & "' And [Entry Date] Between #" & dtmFrom & "# And #" & dtmTo & "#"

    Imb.



    • Edited by Imb-hb Monday, January 22, 2018 7:11 PM
    • Marked as answer by NoviceVBAuser1775 Tuesday, January 23, 2018 2:38 AM
    Monday, January 22, 2018 7:10 PM
  • thanks, your assistance helped out.  I ended up doing this:

    DoCmd.OpenForm "Reconcile", , , "([From Account] = " & strAccount & ") And ([Entry Date] Between #" & dtmFrom & "# And #" & dtmTo & "#)"

    Tuesday, January 23, 2018 2:39 AM