Results 1 to 18 of 18

Thread: How to delete Record in Access Database?

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Nov 2005
    Posts
    102

    How to delete Record in Access Database?

    Hi there,

    I have few textboxes on my form and those are linking with MS Access Database.
    Is it possible as i Delete the value which is inside the textboxes at the same keystroke of Backspace it also delete from Database from that speed?
    plz help.

  2. #2
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: How to delete Record in Access Database?

    Sure. Are you using real code to display your data, or bound data controls.

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Nov 2005
    Posts
    102

    Re: How to delete Record in Access Database?

    Hack,
    Sorry, what is bound data controls & what is Real Code?

  4. #4
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: How to delete Record in Access Database?

    Real code is programming code (VB and SQL)

    Bound controls are data controls that you "bind" to a database and in which records are automatically displayed without having to write any code at all.

  5. #5

    Thread Starter
    Lively Member
    Join Date
    Nov 2005
    Posts
    102

    Re: How to delete Record in Access Database?

    Well, i think i'm using Bound Controls, because i'm using (ADODC1). But in code window i'm also writing code like that:

    Private Sub ckconsr_KeyPress(KeyAscii As Integer)
    If KeyAscii = 13 Then
    txtckstocksr1.Text = Val(ckconsr.Text) - Val(txtckstocksr1.Text)

    txtgypconsr.SetFocus
    End If
    Select Case KeyAscii
    Case 48 To 57, 46, 8
    'do nothing
    Case Else
    KeyAscii = 0
    End Select
    End Sub

    -----------
    please help (if you could give me your any messenger ID like yahoo or msn so that i may connect for live help please), if it suits you...?

  6. #6
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: How to delete Record in Access Database?

    Quote Originally Posted by Plucky
    Hi there,

    I have few textboxes on my form and those are linking with MS Access Database.
    Is it possible as i Delete the value which is inside the textboxes at the same keystroke of Backspace it also delete from Database from that speed?
    plz help.
    Ok. So you are using a combination of the two. In that case, I don't know what kind of example to give you.

    Lets start with specifically defining your end goal.

    If I'm reading this correctly, you would have something in a textbox. Example: the word "yellow"

    The word yellow would also be in a field in your database table. If you backspaced out the w, leaving yello, then you want your database field to be updated with yello. Is that correct?

  7. #7

    Thread Starter
    Lively Member
    Join Date
    Nov 2005
    Posts
    102

    Re: How to delete Record in Access Database?

    Ok, let me tell you in detail the excact problem.. leave this Question,

    For Example:
    I have three textboxes on form
    =========================
    txtorange.text
    txtmango.text
    txttotalamount.text

    Entry of values in side these textboxes are saving in Database Access in mean while.
    So i am using code like that on keypress even:

    If keyasscii = 13 then (on txtmango.text)
    txttotalamount.text = val(txtorange.text) + val(txtmango.text)
    end If

    Result savess in database, but when i simply press enter key again on these texboxes it add same value whcih already in txttotalamount.text again into the txttotalamount.text during edit mode.
    plz help,

  8. #8
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: How to delete Record in Access Database?

    Quote Originally Posted by Plucky
    Ok, let me tell you in detail the excact problem.. leave this Question,

    For Example:
    I have three textboxes on form
    =========================
    txtorange.text
    txtmango.text
    txttotalamount.text

    Entry of values in side these textboxes are saving in Database Access in mean while.
    So i am using code like that on keypress even:

    If keyasscii = 13 then (on txtmango.text)
    txttotalamount.text = val(txtorange.text) + val(txtmango.text)
    end If

    Result savess in database, but when i simply press enter key again on these texboxes it add same value whcih already in txttotalamount.text again into the txttotalamount.text during edit mode.
    plz help,
    Yes...what you have said makes perfect sense. You have your code in the keypress event, so every time a key is pressed in that textbox, the code will run. It is doing what you are telling it to do.

    Now, what do you want it to do?

  9. #9

    Thread Starter
    Lively Member
    Join Date
    Nov 2005
    Posts
    102

    Re: How to delete Record in Access Database?

    Mr. Hack,
    Actually i have 2 command buttons on form. Button 1- for Add new record in Database and 2-Button for Modification/Editing existing record. When i add any new record in MS Access database by pressing 1- button it work nicely record add and save also. the second btton which is for Editing in existing record. During Editing existing record that problem occured. When i press Enter key on txtmango it add value of previous result in to existing, in mean while i'm not adding any new value or write in textbox...
    It should not add any thing in to the result becuase it is just editing and either i don't want to add any new value, on just pressing enter key it added..
    something like, that.. i hope you could understood..

  10. #10
    Junior Member
    Join Date
    Dec 2005
    Location
    Surat,India
    Posts
    29

    Re: How to delete Record in Access Database?

    Hi,
    you have to set a flag in keypress eve. for add button and edit button
    Virendrasinh Narendrasinh Mahida
    ----------------------------------
    There is Never a WRONG time to do the RIGHT Thing

  11. #11

    Thread Starter
    Lively Member
    Join Date
    Nov 2005
    Posts
    102

    Re: How to delete Record in Access Database?

    mvirendra,
    could you please define?
    I have had already attempt it, but not working more than one addition..
    help,

  12. #12
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: How to delete Record in Access Database?

    Do you have code in an Edit command button?

  13. #13

    Thread Starter
    Lively Member
    Join Date
    Nov 2005
    Posts
    102

    Re: How to delete Record in Access Database?

    Mr. Hack,
    No i don't have Edit button on form. I don't know how to use Edit mod..
    help plz
    Last edited by Plucky; Dec 29th, 2005 at 08:03 AM.

  14. #14
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: How to delete Record in Access Database?

    Ok, I just went back through all the posts in this thread and can't find any code that you posted that actually does the saving of the data back to the database.

    What are you using for that, and where does it get executed?

  15. #15

    Thread Starter
    Lively Member
    Join Date
    Nov 2005
    Posts
    102

    Re: How to delete Record in Access Database?

    Mr. Hack,
    I'm very impressed by your pain taking habit, your are very very good in VB.
    I was doing a mistake in my code, finnaly i solved it by myself...
    Thanks to all people, those remained helpful in this thread..
    c ya,
    Last edited by Plucky; Dec 30th, 2005 at 06:27 AM.

  16. #16
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: How to delete Record in Access Database?

    Quote Originally Posted by Plucky
    Mr. Hack,
    I'm very impressed by your pain taking habit, your are very very good in VB.
    I was doing a mistake in my code, finnaly i solved it by myself...
    Thanks to all people, those remained helpful in this thread..
    c ya,
    Post your resolution for others. I'm certain that the mistake you made could be made by others and they could benefit from your experience.

  17. #17

    Thread Starter
    Lively Member
    Join Date
    Nov 2005
    Posts
    102

    Re: How to delete Record in Access Database?

    Here is the Code:

    Private Sub txtckprodopc1_KeyPress(KeyAscii As Integer)
    If KeyAscii = 13 Then

    Adodc1.Recordset.MovePrevious
    prvstkopc = Adodc1.Recordset.Fields(7).Value
    Adodc1.Recordset.MoveNext
    txtckstockop1.Text = Val(txtckprodopc1.Text) + prvstkopc

    txtckprodsrc.SetFocus

    End If
    --------------------

  18. #18
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: How to delete Record in Access Database?

    Thanks Plucky!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width