Welcome to SPN

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

Sign Up Now!

Use Back Space to delete Row in Combo Box

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

  1. Daniel

    Daniel
    Expand Collapse
    Guest

    I would like to be able to delete a row in a Combo Box (which resides on a
    subform on a main form) with Back Space, but when I delete the content of the
    row in the Combo Box with Back Space, the row remians empty and it is not
    deleted even when I close the form and open it again. I have seen this in a
    database before but I do not why it is not possible in this case. Thanks in
    advance for any help.

    Regards,
    Daniel
    I can provide details of the database design when needed.
     
  2. Loading...

    Similar Threads Forum Date
    Sikhi Gurdwaras Throw Open Their Spaces, Langar For Stranded Commuters In Haryana Sikh Sikhi Sikhism Feb 23, 2016
    SciTech Urgent Need to Remove Space Debris Breaking News Apr 25, 2013
    India Panthic space shrinking within Akali Dal; more Hindus for parliament Breaking News Mar 28, 2013
    Prayer / Simran Space Questions and Answers Jun 1, 2012
    SciTech Stephen Hawking: Colonize Space or End the Human Race Breaking News Jan 9, 2012

  3. Daniel

    Daniel
    Expand Collapse
    Guest

    Guys some assistance, I am using now this code in the afterupdate event when
    a user deletes a record using back space, there should be a another way..

    Private Sub Form_AfterUpdate()
    If IsNull(Me![cmbGROUPNAME]) Then
    MsgBox "Please select the empty record and press delete on the keyboard",
    vbOKOnly
    End If
    End Sub

    "Daniel" wrote:

    > I would like to be able to delete a row in a Combo Box (which resides on a
    > subform on a main form) with Back Space, but when I delete the content of the
    > row in the Combo Box with Back Space, the row remians empty and it is not
    > deleted even when I close the form and open it again. I have seen this in a
    > database before but I do not why it is not possible in this case. Thanks in
    > advance for any help.
    >
    > Regards,
    > Daniel
    > I can provide details of the database design when needed.
    >
    >
     
  4. Tom Ellison

    Tom Ellison
    Expand Collapse
    Guest

    Dear Daniel:

    If the combo box is filled using a query, you could rewrite the SQL for each
    delete, then requery the combo box using the new SQL. A nasty, and I
    suspect unavoidable side effect would be that the requery will put you back
    a the top of the list, and likely close the list to boot (not sure of that,
    just a suspicion).

    Tom Ellison


    "Daniel" <Daniel@discussions.microsoft.com> wrote in message
    news:F68A6F3F-12BB-4073-A154-EA438F7EB0DC@microsoft.com...
    > Guys some assistance, I am using now this code in the afterupdate event
    > when
    > a user deletes a record using back space, there should be a another way..
    >
    > Private Sub Form_AfterUpdate()
    > If IsNull(Me![cmbGROUPNAME]) Then
    > MsgBox "Please select the empty record and press delete on the keyboard",
    > vbOKOnly
    > End If
    > End Sub
    >
    > "Daniel" wrote:
    >
    >> I would like to be able to delete a row in a Combo Box (which resides on
    >> a
    >> subform on a main form) with Back Space, but when I delete the content of
    >> the
    >> row in the Combo Box with Back Space, the row remians empty and it is not
    >> deleted even when I close the form and open it again. I have seen this in
    >> a
    >> database before but I do not why it is not possible in this case. Thanks
    >> in
    >> advance for any help.
    >>
    >> Regards,
    >> Daniel
    >> I can provide details of the database design when needed.
    >>
    >>
     
  5. Daniel

    Daniel
    Expand Collapse
    Guest

    Dear Tom,

    Thanks for your reply, unfortuantely I am not familiar with SQL except that
    I know how to change the view of a query to SQL :(
    It is a little difficult to explain how the combo box resides on the main
    form.
    I first added a subform to the main form and made these links:
    Link Child Fields: CONTACT_ID
    Link Master Fields: CONTACT_ID
    Then I added one combo box to the subform and deleted the other fields.
    Other important properties of the subform:
    Control Source: GROUPNAME
    Row Source Type: Table/Query
    Row Source: SELECT GROUP.GROUPNAME FROM [GROUP] GROUP BY GROUP.GROUPNAME
    ORDER BY GROUP.GROUPNAME;

    Regards,
    Daniel

    "Tom Ellison" wrote:

    > Dear Daniel:
    >
    > If the combo box is filled using a query, you could rewrite the SQL for each
    > delete, then requery the combo box using the new SQL. A nasty, and I
    > suspect unavoidable side effect would be that the requery will put you back
    > a the top of the list, and likely close the list to boot (not sure of that,
    > just a suspicion).
    >
    > Tom Ellison
    >
    >
    > "Daniel" <Daniel@discussions.microsoft.com> wrote in message
    > news:F68A6F3F-12BB-4073-A154-EA438F7EB0DC@microsoft.com...
    > > Guys some assistance, I am using now this code in the afterupdate event
    > > when
    > > a user deletes a record using back space, there should be a another way..
    > >
    > > Private Sub Form_AfterUpdate()
    > > If IsNull(Me![cmbGROUPNAME]) Then
    > > MsgBox "Please select the empty record and press delete on the keyboard",
    > > vbOKOnly
    > > End If
    > > End Sub
    > >
    > > "Daniel" wrote:
    > >
    > >> I would like to be able to delete a row in a Combo Box (which resides on
    > >> a
    > >> subform on a main form) with Back Space, but when I delete the content of
    > >> the
    > >> row in the Combo Box with Back Space, the row remians empty and it is not
    > >> deleted even when I close the form and open it again. I have seen this in
    > >> a
    > >> database before but I do not why it is not possible in this case. Thanks
    > >> in
    > >> advance for any help.
    > >>
    > >> Regards,
    > >> Daniel
    > >> I can provide details of the database design when needed.
    > >>
    > >>

    >
    >
    >
     
  6. Tom Ellison

    Tom Ellison
    Expand Collapse
    Guest

    Dear Daniel:

    This is a skill you're going to need more and more as you progress. I
    suggest you take the time and effort as soon as possible.

    Tom Ellison


    "Daniel" <Daniel@discussions.microsoft.com> wrote in message
    news:28FDDBEA-73D8-4845-AAD3-CAE496F22DEA@microsoft.com...
    > Dear Tom,
    >
    > Thanks for your reply, unfortuantely I am not familiar with SQL except
    > that
    > I know how to change the view of a query to SQL :(
    > It is a little difficult to explain how the combo box resides on the main
    > form.
    > I first added a subform to the main form and made these links:
    > Link Child Fields: CONTACT_ID
    > Link Master Fields: CONTACT_ID
    > Then I added one combo box to the subform and deleted the other fields.
    > Other important properties of the subform:
    > Control Source: GROUPNAME
    > Row Source Type: Table/Query
    > Row Source: SELECT GROUP.GROUPNAME FROM [GROUP] GROUP BY GROUP.GROUPNAME
    > ORDER BY GROUP.GROUPNAME;
    >
    > Regards,
    > Daniel
    >
    > "Tom Ellison" wrote:
    >
    >> Dear Daniel:
    >>
    >> If the combo box is filled using a query, you could rewrite the SQL for
    >> each
    >> delete, then requery the combo box using the new SQL. A nasty, and I
    >> suspect unavoidable side effect would be that the requery will put you
    >> back
    >> a the top of the list, and likely close the list to boot (not sure of
    >> that,
    >> just a suspicion).
    >>
    >> Tom Ellison
    >>
    >>
    >> "Daniel" <Daniel@discussions.microsoft.com> wrote in message
    >> news:F68A6F3F-12BB-4073-A154-EA438F7EB0DC@microsoft.com...
    >> > Guys some assistance, I am using now this code in the afterupdate event
    >> > when
    >> > a user deletes a record using back space, there should be a another
    >> > way..
    >> >
    >> > Private Sub Form_AfterUpdate()
    >> > If IsNull(Me![cmbGROUPNAME]) Then
    >> > MsgBox "Please select the empty record and press delete on the
    >> > keyboard",
    >> > vbOKOnly
    >> > End If
    >> > End Sub
    >> >
    >> > "Daniel" wrote:
    >> >
    >> >> I would like to be able to delete a row in a Combo Box (which resides
    >> >> on
    >> >> a
    >> >> subform on a main form) with Back Space, but when I delete the content
    >> >> of
    >> >> the
    >> >> row in the Combo Box with Back Space, the row remians empty and it is
    >> >> not
    >> >> deleted even when I close the form and open it again. I have seen this
    >> >> in
    >> >> a
    >> >> database before but I do not why it is not possible in this case.
    >> >> Thanks
    >> >> in
    >> >> advance for any help.
    >> >>
    >> >> Regards,
    >> >> Daniel
    >> >> I can provide details of the database design when needed.
    >> >>
    >> >>

    >>
    >>
    >>
     
  7. Daniel

    Daniel
    Expand Collapse
    Guest

    Thank you for the advice.
    Wish you well,
    Daniel

    "Tom Ellison" wrote:

    > Dear Daniel:
    >
    > This is a skill you're going to need more and more as you progress. I
    > suggest you take the time and effort as soon as possible.
    >
    > Tom Ellison
    >
    >
    > "Daniel" <Daniel@discussions.microsoft.com> wrote in message
    > news:28FDDBEA-73D8-4845-AAD3-CAE496F22DEA@microsoft.com...
    > > Dear Tom,
    > >
    > > Thanks for your reply, unfortuantely I am not familiar with SQL except
    > > that
    > > I know how to change the view of a query to SQL :(
    > > It is a little difficult to explain how the combo box resides on the main
    > > form.
    > > I first added a subform to the main form and made these links:
    > > Link Child Fields: CONTACT_ID
    > > Link Master Fields: CONTACT_ID
    > > Then I added one combo box to the subform and deleted the other fields.
    > > Other important properties of the subform:
    > > Control Source: GROUPNAME
    > > Row Source Type: Table/Query
    > > Row Source: SELECT GROUP.GROUPNAME FROM [GROUP] GROUP BY GROUP.GROUPNAME
    > > ORDER BY GROUP.GROUPNAME;
    > >
    > > Regards,
    > > Daniel
    > >
    > > "Tom Ellison" wrote:
    > >
    > >> Dear Daniel:
    > >>
    > >> If the combo box is filled using a query, you could rewrite the SQL for
    > >> each
    > >> delete, then requery the combo box using the new SQL. A nasty, and I
    > >> suspect unavoidable side effect would be that the requery will put you
    > >> back
    > >> a the top of the list, and likely close the list to boot (not sure of
    > >> that,
    > >> just a suspicion).
    > >>
    > >> Tom Ellison
    > >>
    > >>
    > >> "Daniel" <Daniel@discussions.microsoft.com> wrote in message
    > >> news:F68A6F3F-12BB-4073-A154-EA438F7EB0DC@microsoft.com...
    > >> > Guys some assistance, I am using now this code in the afterupdate event
    > >> > when
    > >> > a user deletes a record using back space, there should be a another
    > >> > way..
    > >> >
    > >> > Private Sub Form_AfterUpdate()
    > >> > If IsNull(Me![cmbGROUPNAME]) Then
    > >> > MsgBox "Please select the empty record and press delete on the
    > >> > keyboard",
    > >> > vbOKOnly
    > >> > End If
    > >> > End Sub
    > >> >
    > >> > "Daniel" wrote:
    > >> >
    > >> >> I would like to be able to delete a row in a Combo Box (which resides
    > >> >> on
    > >> >> a
    > >> >> subform on a main form) with Back Space, but when I delete the content
    > >> >> of
    > >> >> the
    > >> >> row in the Combo Box with Back Space, the row remians empty and it is
    > >> >> not
    > >> >> deleted even when I close the form and open it again. I have seen this
    > >> >> in
    > >> >> a
    > >> >> database before but I do not why it is not possible in this case.
    > >> >> Thanks
    > >> >> in
    > >> >> advance for any help.
    > >> >>
    > >> >> Regards,
    > >> >> Daniel
    > >> >> I can provide details of the database design when needed.
    > >> >>
    > >> >>
    > >>
    > >>
    > >>

    >
    >
    >
     
  8. Daniel

    Daniel
    Expand Collapse
    Guest

    May be not ideal but this works:

    Private Sub Form_AfterUpdate()

    If IsNull(Me![cmbGroup]) Then
    stDocName = "qryDelGroupIfNull"
    DoCmd.OpenQuery stDocName, acNormal, acEdit
    End If

    Me.Requery

    End Sub



    "Daniel" wrote:

    > I would like to be able to delete a row in a Combo Box (which resides on a
    > subform on a main form) with Back Space, but when I delete the content of the
    > row in the Combo Box with Back Space, the row remians empty and it is not
    > deleted even when I close the form and open it again. I have seen this in a
    > database before but I do not why it is not possible in this case. Thanks in
    > advance for any help.
    >
    > Regards,
    > Daniel
    > I can provide details of the database design when needed.
    >
    >
     

Share This Page