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.
Printable View
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.
Sure. Are you using real code to display your data, or bound data controls.
Hack,
Sorry, what is bound data controls & what is Real Code?
:)
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.
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...?
Ok. So you are using a combination of the two. In that case, I don't know what kind of example to give you.Quote:
Originally Posted by Plucky
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?
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.Quote:
Originally Posted by Plucky
Now, what do you want it to do?
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..
Hi,
you have to set a flag in keypress eve. for add button and edit button
mvirendra,
could you please define?
I have had already attempt it, but not working more than one addition..
help,
Do you have code in an Edit command button?
Mr. Hack,
No i don't have Edit button on form. I don't know how to use Edit mod..
help plz
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?
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. :)Quote:
Originally Posted by Plucky
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
--------------------
Thanks Plucky! :thumb: