Welcome to SPN

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

Sign Up Now!

Clearing Forms

Discussion in 'Information Technology' started by Justin, Nov 3, 2005.

Tags:
  1. Justin

    Justin
    Expand Collapse
    Guest

    Have a question, i have this order entry form, where the user enter
    appropriate data and once press "Add record", it will first check a table
    that will see if that data that was just enter is duplicated to what the
    table has. If it does, it will open up another form, showing the user the
    data. Now i need to have it that it has a yes and no button,

    yes, to add this data
    and no to delete teh data, and return to other screen

    My problem when creating the NO button, i created to go back to other form,
    but the information is still there.

    Need help.thanks
     
  2. Loading...

    Similar Threads Forum Date
    Clearing Spiritual Concepts Interfaith Dialogues Jun 24, 2007
    USA Akaal Takhat Forms Committee to Represent US Sikhs Breaking News Sep 13, 2013
    India Poll reforms on crash course Breaking News Sep 7, 2013
    General A Conversation about the Grammatical Forms of Raam and Simran Hard Talk Dec 1, 2011
    India Anna Says Fast Only "Suspended", Wants Electoral Reforms Breaking News Aug 28, 2011

  3. Arvin Meyer [MVP]

    Arvin Meyer [MVP]
    Expand Collapse
    Guest

    The default behavior of Access is to use bound forms. The data will then be
    saved automatically. You can use unbound forms and write code to explictly
    save the record, or you can use the bound form, save the record, and then
    delete it. The second method is actually much simpler. Some sample code to do
    it might look like this:

    Sub NoSave_Click()
    DoCmd.RunCommand acCmdSaveRecord
    CurrentDb.Execute "Delete * From MyTable Where IDField=" & Me.txtIDField
    End Sub

    Of course you need to substitute the appropriate names.
    --
    Arvin Meyer, MCP, MVP
    Microsoft Access
    Free Access downloads
    http://www.datastrat.com
    http://www.mvps.org/access


    "Justin" wrote:

    > Have a question, i have this order entry form, where the user enter
    > appropriate data and once press "Add record", it will first check a table
    > that will see if that data that was just enter is duplicated to what the
    > table has. If it does, it will open up another form, showing the user the
    > data. Now i need to have it that it has a yes and no button,
    >
    > yes, to add this data
    > and no to delete teh data, and return to other screen
    >
    > My problem when creating the NO button, i created to go back to other form,
    > but the information is still there.
    >
    > Need help.thanks
     
  4. Justin

    Justin
    Expand Collapse
    Guest

    Im getting an error when i made the appropriate changes

    this is what i did

    CurrentDb.Execute "DELETE Check_Data_OrderEntry.*,
    Check_Data_OrderEntry.KeyNumber FROM Check_Data_OrderEntry WHERE
    (Check_Data_OrderEntry.KeyNumber)" = Me.txtKeyNumber

    but im getting the error "compile error, method or data not found.

    please help



    "Arvin Meyer [MVP]" wrote:

    > The default behavior of Access is to use bound forms. The data will then be
    > saved automatically. You can use unbound forms and write code to explictly
    > save the record, or you can use the bound form, save the record, and then
    > delete it. The second method is actually much simpler. Some sample code to do
    > it might look like this:
    >
    > Sub NoSave_Click()
    > DoCmd.RunCommand acCmdSaveRecord
    > CurrentDb.Execute "Delete * From MyTable Where IDField=" & Me.txtIDField
    > End Sub
    >
    > Of course you need to substitute the appropriate names.
    > --
    > Arvin Meyer, MCP, MVP
    > Microsoft Access
    > Free Access downloads
    > http://www.datastrat.com
    > http://www.mvps.org/access
    >
    >
    > "Justin" wrote:
    >
    > > Have a question, i have this order entry form, where the user enter
    > > appropriate data and once press "Add record", it will first check a table
    > > that will see if that data that was just enter is duplicated to what the
    > > table has. If it does, it will open up another form, showing the user the
    > > data. Now i need to have it that it has a yes and no button,
    > >
    > > yes, to add this data
    > > and no to delete teh data, and return to other screen
    > >
    > > My problem when creating the NO button, i created to go back to other form,
    > > but the information is still there.
    > >
    > > Need help.thanks
     
  5. Douglas J Steele

    Douglas J Steele
    Expand Collapse
    Guest

    Your equal sign is in the wrong place, and you're missing the concatentation
    operator. (As well, there's no need to include KeyNumber specifically in the
    DELETE part: the query deletes the entire row, not specific fields):

    CurrentDb.Execute "DELETE * FROM Check_Data_OrderEntry " & _
    "WHERE KeyNumber = " & Me.txtKeyNumber

    That assumes that KeyNumber is a numeric field. If it's text, you'll need to
    use

    CurrentDb.Execute "DELETE * FROM Check_Data_OrderEntry " & _
    "WHERE KeyNumber = " & Chr$(34) & Me.txtKeyNumber & Chr$(34)

    --
    Doug Steele, Microsoft Access MVP
    http://I.Am/DougSteele
    (no e-mails, please!)


    "Justin" <Justin@discussions.microsoft.com> wrote in message
    news:A9A28779-663B-444A-9144-A9EB4482D04D@microsoft.com...
    > Im getting an error when i made the appropriate changes
    >
    > this is what i did
    >
    > CurrentDb.Execute "DELETE Check_Data_OrderEntry.*,
    > Check_Data_OrderEntry.KeyNumber FROM Check_Data_OrderEntry WHERE
    > (Check_Data_OrderEntry.KeyNumber)" = Me.txtKeyNumber
    >
    > but im getting the error "compile error, method or data not found.
    >
    > please help
    >
    >
    >
    > "Arvin Meyer [MVP]" wrote:
    >
    > > The default behavior of Access is to use bound forms. The data will then

    be
    > > saved automatically. You can use unbound forms and write code to

    explictly
    > > save the record, or you can use the bound form, save the record, and

    then
    > > delete it. The second method is actually much simpler. Some sample code

    to do
    > > it might look like this:
    > >
    > > Sub NoSave_Click()
    > > DoCmd.RunCommand acCmdSaveRecord
    > > CurrentDb.Execute "Delete * From MyTable Where IDField=" &

    Me.txtIDField
    > > End Sub
    > >
    > > Of course you need to substitute the appropriate names.
    > > --
    > > Arvin Meyer, MCP, MVP
    > > Microsoft Access
    > > Free Access downloads
    > > http://www.datastrat.com
    > > http://www.mvps.org/access
    > >
    > >
    > > "Justin" wrote:
    > >
    > > > Have a question, i have this order entry form, where the user enter
    > > > appropriate data and once press "Add record", it will first check a

    table
    > > > that will see if that data that was just enter is duplicated to what

    the
    > > > table has. If it does, it will open up another form, showing the user

    the
    > > > data. Now i need to have it that it has a yes and no button,
    > > >
    > > > yes, to add this data
    > > > and no to delete teh data, and return to other screen
    > > >
    > > > My problem when creating the NO button, i created to go back to other

    form,
    > > > but the information is still there.
    > > >
    > > > Need help.thanks
     

Share This Page