Welcome to SPN

Register and Join the most happening forum of Sikh community & intellectuals from around the world.

Sign Up Now!

Activate Macro based on Query Results

Discussion in 'Information Technology' started by Todd, Jul 28, 2006.

  1. Todd

    Todd
    Expand Collapse
    Guest

    I have a query that has a field that calculates how many days until the next
    contact needs to be made. What I would like is when the main form opens the
    query will run in the background and if the number of days on the query field
    is 0 or less a popup box will appear that says contact needs to be made today
    or something to that affect. I do not want the query to appear, all this
    needs to be transparent to the user. Thanks for any help!
     
  2. Loading...

    Similar Threads Forum Date
    Microcosm and Macrocosm Gurmat Vichaar Mar 20, 2009
    Adobe Unruffled by Macromedia Restatement (AP) Interfaith Dialogues May 4, 2005
    Macromedia Flash animation and designing. Interfaith Dialogues Oct 21, 2004

  3. Todd

    Todd
    Expand Collapse
    Guest

    I get the following error:

    Syntax error (missing operator) in query expression 'Days to Follow Up'.
    (that is my field name in my query)
    "Ofer Cohen" wrote:

    > If the query return one value, which is the number of days try this code on
    > the load event of the form
    >
    > If Dlookup("FieldName","QueryName") < 1 Then
    > MsgBox "contact needs to be made today"
    > End If
    >
    > --
    > Good Luck
    > BS"D
    >
    >
    > "Todd" wrote:
    >
    > > I have a query that has a field that calculates how many days until the next
    > > contact needs to be made. What I would like is when the main form opens the
    > > query will run in the background and if the number of days on the query field
    > > is 0 or less a popup box will appear that says contact needs to be made today
    > > or something to that affect. I do not want the query to appear, all this
    > > needs to be transparent to the user. Thanks for any help!
     
  4. Ofer Cohen

    Ofer Cohen
    Expand Collapse
    Guest

    Can you post th code?
    But before, if the field or table consist more then one word add a square
    brackets to it

    Dlookup("[FieldName]","[QueryName]")
    --
    Good Luck
    BS"D


    "Todd" wrote:

    > I get the following error:
    >
    > Syntax error (missing operator) in query expression 'Days to Follow Up'.
    > (that is my field name in my query)
    > "Ofer Cohen" wrote:
    >
    > > If the query return one value, which is the number of days try this code on
    > > the load event of the form
    > >
    > > If Dlookup("FieldName","QueryName") < 1 Then
    > > MsgBox "contact needs to be made today"
    > > End If
    > >
    > > --
    > > Good Luck
    > > BS"D
    > >
    > >
    > > "Todd" wrote:
    > >
    > > > I have a query that has a field that calculates how many days until the next
    > > > contact needs to be made. What I would like is when the main form opens the
    > > > query will run in the background and if the number of days on the query field
    > > > is 0 or less a popup box will appear that says contact needs to be made today
    > > > or something to that affect. I do not want the query to appear, all this
    > > > needs to be transparent to the user. Thanks for any help!
     
  5. Todd

    Todd
    Expand Collapse
    Guest

    It lets the code go through but the box doesn't appera and there are several
    that are <1 day. Here is my form load code:

    Private Sub Form_Load()
    DoCmd.Maximize
    DoCmd.GoToRecord , , acNewRec
    Calendar.Visible = False
    Calendar2.Visible = False
    If DLookup("[Days to Follow Up Date]", "[qryFollowUp]") < 1 Then
    MsgBox "contact needs to be made today"
    End If

    End Sub

    "Ofer Cohen" wrote:

    > Can you post th code?
    > But before, if the field or table consist more then one word add a square
    > brackets to it
    >
    > Dlookup("[FieldName]","[QueryName]")
    > --
    > Good Luck
    > BS"D
    >
    >
    > "Todd" wrote:
    >
    > > I get the following error:
    > >
    > > Syntax error (missing operator) in query expression 'Days to Follow Up'.
    > > (that is my field name in my query)
    > > "Ofer Cohen" wrote:
    > >
    > > > If the query return one value, which is the number of days try this code on
    > > > the load event of the form
    > > >
    > > > If Dlookup("FieldName","QueryName") < 1 Then
    > > > MsgBox "contact needs to be made today"
    > > > End If
    > > >
    > > > --
    > > > Good Luck
    > > > BS"D
    > > >
    > > >
    > > > "Todd" wrote:
    > > >
    > > > > I have a query that has a field that calculates how many days until the next
    > > > > contact needs to be made. What I would like is when the main form opens the
    > > > > query will run in the background and if the number of days on the query field
    > > > > is 0 or less a popup box will appear that says contact needs to be made today
    > > > > or something to that affect. I do not want the query to appear, all this
    > > > > needs to be transparent to the user. Thanks for any help!
     
  6. Ofer Cohen

    Ofer Cohen
    Expand Collapse
    Guest

    If the query return one value, which is the number of days try this code on
    the load event of the form

    If Dlookup("FieldName","QueryName") < 1 Then
    MsgBox "contact needs to be made today"
    End If

    --
    Good Luck
    BS"D


    "Todd" wrote:

    > I have a query that has a field that calculates how many days until the next
    > contact needs to be made. What I would like is when the main form opens the
    > query will run in the background and if the number of days on the query field
    > is 0 or less a popup box will appear that says contact needs to be made today
    > or something to that affect. I do not want the query to appear, all this
    > needs to be transparent to the user. Thanks for any help!
     
  7. Ofer Cohen

    Ofer Cohen
    Expand Collapse
    Guest

    Are there few records you are checking in? If so, try something else

    If DCount("*", "[qryFollowUp]","[Days to Follow Up Date] < 1") > 0 Then
    MsgBox "contact needs to be made today"
    End If

    --
    Good Luck
    BS"D


    "Todd" wrote:

    > It lets the code go through but the box doesn't appera and there are several
    > that are <1 day. Here is my form load code:
    >
    > Private Sub Form_Load()
    > DoCmd.Maximize
    > DoCmd.GoToRecord , , acNewRec
    > Calendar.Visible = False
    > Calendar2.Visible = False
    > If DLookup("[Days to Follow Up Date]", "[qryFollowUp]") < 1 Then
    > MsgBox "contact needs to be made today"
    > End If
    >
    > End Sub
    >
    > "Ofer Cohen" wrote:
    >
    > > Can you post th code?
    > > But before, if the field or table consist more then one word add a square
    > > brackets to it
    > >
    > > Dlookup("[FieldName]","[QueryName]")
    > > --
    > > Good Luck
    > > BS"D
    > >
    > >
    > > "Todd" wrote:
    > >
    > > > I get the following error:
    > > >
    > > > Syntax error (missing operator) in query expression 'Days to Follow Up'.
    > > > (that is my field name in my query)
    > > > "Ofer Cohen" wrote:
    > > >
    > > > > If the query return one value, which is the number of days try this code on
    > > > > the load event of the form
    > > > >
    > > > > If Dlookup("FieldName","QueryName") < 1 Then
    > > > > MsgBox "contact needs to be made today"
    > > > > End If
    > > > >
    > > > > --
    > > > > Good Luck
    > > > > BS"D
    > > > >
    > > > >
    > > > > "Todd" wrote:
    > > > >
    > > > > > I have a query that has a field that calculates how many days until the next
    > > > > > contact needs to be made. What I would like is when the main form opens the
    > > > > > query will run in the background and if the number of days on the query field
    > > > > > is 0 or less a popup box will appear that says contact needs to be made today
    > > > > > or something to that affect. I do not want the query to appear, all this
    > > > > > needs to be transparent to the user. Thanks for any help!
     
  8. Todd

    Todd
    Expand Collapse
    Guest

    That works perfectly. One more thing. What is the code that will put a
    title on the Msgbox?

    "Ofer Cohen" wrote:

    > Are there few records you are checking in? If so, try something else
    >
    > If DCount("*", "[qryFollowUp]","[Days to Follow Up Date] < 1") > 0 Then
    > MsgBox "contact needs to be made today"
    > End If
    >
    > --
    > Good Luck
    > BS"D
    >
    >
    > "Todd" wrote:
    >
    > > It lets the code go through but the box doesn't appera and there are several
    > > that are <1 day. Here is my form load code:
    > >
    > > Private Sub Form_Load()
    > > DoCmd.Maximize
    > > DoCmd.GoToRecord , , acNewRec
    > > Calendar.Visible = False
    > > Calendar2.Visible = False
    > > If DLookup("[Days to Follow Up Date]", "[qryFollowUp]") < 1 Then
    > > MsgBox "contact needs to be made today"
    > > End If
    > >
    > > End Sub
    > >
    > > "Ofer Cohen" wrote:
    > >
    > > > Can you post th code?
    > > > But before, if the field or table consist more then one word add a square
    > > > brackets to it
    > > >
    > > > Dlookup("[FieldName]","[QueryName]")
    > > > --
    > > > Good Luck
    > > > BS"D
    > > >
    > > >
    > > > "Todd" wrote:
    > > >
    > > > > I get the following error:
    > > > >
    > > > > Syntax error (missing operator) in query expression 'Days to Follow Up'.
    > > > > (that is my field name in my query)
    > > > > "Ofer Cohen" wrote:
    > > > >
    > > > > > If the query return one value, which is the number of days try this code on
    > > > > > the load event of the form
    > > > > >
    > > > > > If Dlookup("FieldName","QueryName") < 1 Then
    > > > > > MsgBox "contact needs to be made today"
    > > > > > End If
    > > > > >
    > > > > > --
    > > > > > Good Luck
    > > > > > BS"D
    > > > > >
    > > > > >
    > > > > > "Todd" wrote:
    > > > > >
    > > > > > > I have a query that has a field that calculates how many days until the next
    > > > > > > contact needs to be made. What I would like is when the main form opens the
    > > > > > > query will run in the background and if the number of days on the query field
    > > > > > > is 0 or less a popup box will appear that says contact needs to be made today
    > > > > > > or something to that affect. I do not want the query to appear, all this
    > > > > > > needs to be transparent to the user. Thanks for any help!
     
  9. Ofer Cohen

    Ofer Cohen
    Expand Collapse
    Guest

    Try
    MsgBox "contact needs to be made today" , , "Title"

    --
    Good Luck
    BS"D


    "Todd" wrote:

    > That works perfectly. One more thing. What is the code that will put a
    > title on the Msgbox?
    >
    > "Ofer Cohen" wrote:
    >
    > > Are there few records you are checking in? If so, try something else
    > >
    > > If DCount("*", "[qryFollowUp]","[Days to Follow Up Date] < 1") > 0 Then
    > > MsgBox "contact needs to be made today"
    > > End If
    > >
    > > --
    > > Good Luck
    > > BS"D
    > >
    > >
    > > "Todd" wrote:
    > >
    > > > It lets the code go through but the box doesn't appera and there are several
    > > > that are <1 day. Here is my form load code:
    > > >
    > > > Private Sub Form_Load()
    > > > DoCmd.Maximize
    > > > DoCmd.GoToRecord , , acNewRec
    > > > Calendar.Visible = False
    > > > Calendar2.Visible = False
    > > > If DLookup("[Days to Follow Up Date]", "[qryFollowUp]") < 1 Then
    > > > MsgBox "contact needs to be made today"
    > > > End If
    > > >
    > > > End Sub
    > > >
    > > > "Ofer Cohen" wrote:
    > > >
    > > > > Can you post th code?
    > > > > But before, if the field or table consist more then one word add a square
    > > > > brackets to it
    > > > >
    > > > > Dlookup("[FieldName]","[QueryName]")
    > > > > --
    > > > > Good Luck
    > > > > BS"D
    > > > >
    > > > >
    > > > > "Todd" wrote:
    > > > >
    > > > > > I get the following error:
    > > > > >
    > > > > > Syntax error (missing operator) in query expression 'Days to Follow Up'.
    > > > > > (that is my field name in my query)
    > > > > > "Ofer Cohen" wrote:
    > > > > >
    > > > > > > If the query return one value, which is the number of days try this code on
    > > > > > > the load event of the form
    > > > > > >
    > > > > > > If Dlookup("FieldName","QueryName") < 1 Then
    > > > > > > MsgBox "contact needs to be made today"
    > > > > > > End If
    > > > > > >
    > > > > > > --
    > > > > > > Good Luck
    > > > > > > BS"D
    > > > > > >
    > > > > > >
    > > > > > > "Todd" wrote:
    > > > > > >
    > > > > > > > I have a query that has a field that calculates how many days until the next
    > > > > > > > contact needs to be made. What I would like is when the main form opens the
    > > > > > > > query will run in the background and if the number of days on the query field
    > > > > > > > is 0 or less a popup box will appear that says contact needs to be made today
    > > > > > > > or something to that affect. I do not want the query to appear, all this
    > > > > > > > needs to be transparent to the user. Thanks for any help!
     

Share This Page