Welcome to Dream.In.Code
Getting VB Help is Easy!

Join 136,470 VB Programmers for FREE! Get instant access to thousands of VB experts, tutorials, code snippets, and more! There are 1,547 people online right now. Registration is fast and FREE... Join Now!




VB 6 and MS access 2003

 
Reply to this topicStart new topic

VB 6 and MS access 2003, when add the record then error show '3251'

mahmood_662@yahoo.com
2 Jul, 2008 - 08:28 PM
Post #1

New D.I.C Head
*

Joined: 2 Jul, 2008
Posts: 1

vb

Dim conn As New ADODB.Connection
Dim rec As New ADODB.Recordset

Private Sub Command1_Click()
txtEmpID.Text = " "
txtEmpName.Text = " "
txtDesignation.Text = " "
txtLoginName.Text = " "
txtDepartment.Text = " "
txtApplTitle.Text = " "
txtRemarks.Text = " "
rec.AddNew

End Sub

Private Sub Command2_Click()
rec("EmpID") = txtEmpID.Text
rec("EmpName") = txtEmpName.Text
rec("Designation") = txtDesignation.Text
rec("LoginName") = txtLoginName.Text
rec("Department") = txtDepartment.Text
rec("ApplTitle") = txtApplTitle.Text
rec("Remarks") = txtRemarks.Text
rec.Update

End Sub

Private Sub Command3_Click()
conn.Execute ("delete from frmApplicationAccess where EmpID='" & EmpID.Text & "' ")
MsgBox "Reord is suessfully deleted"
rec.MoveNext
If rec.EOF Then
MsgBox "End of Reord"
rec.MoveLast

Else

txtEmpID.Text = rec("EmpID")
txtEmpName.Text = rec("EmpName")
txtDesignation.Text = rec("Designation")
txtLoginName.Text = rec("LoginName")
txtDepartment.Text = rec("Department")
txtApplTitle.Text = rec("ApplTitle")
txtRemarks.Text = rec("Remarks")
End If

End Sub

Private Sub Command4_Click()
rec.MoveNext
If rec.EOF Then
MsgBox "End of the Record"
rec.MoveLast
End If
txtEmpID.Text = rec("EmpID")
txtEmpName.Text = rec("EmpName")
txtDesignation.Text = rec("Designation")
txtLoginName.Text = rec("LoginName")
txtDepartment.Text = rec("Department")
txtApplTitle.Text = rec("ApplTitle")
txtRemarks.Text = rec("Remarks")

End Sub

Private Sub Command5_Click()
rec.MovePrevious
If rec.BOF Then
MsgBox "End of the Record"
rec.MoveFirst
End If
txtEmpID.Text = rec("EmpID")
txtEmpName.Text = rec("EmpName")
txtDesignation.Text = rec("Designation")
txtLoginName.Text = rec("LoginName")
txtDepartment.Text = rec("Department")
txtApplTitle.Text = rec("ApplTitle")
txtRemarks.Text = rec("Remarks")

End Sub

Private Sub Form_Load()
rec.CursorType = adOpenDynamic
conn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=AssetManagement.mdb"
rec.Open "Select * from frmApplicationAccess", conn
txtEmpID.Text = rec("EmpID")
txtEmpName.Text = rec("EmpName")
txtDesignation.Text = rec("Designation")
txtLoginName.Text = rec("LoginName")
txtDepartment.Text = rec("Department")
txtApplTitle.Text = rec("ApplTitle")
txtRemarks.Text = rec("Remarks")

End Sub


** Edit ** code.gif
User is offlineProfile CardPM
+Quote Post

Locke37
RE: VB 6 And MS Access 2003
2 Jul, 2008 - 09:06 PM
Post #2

I'm not a thief...I prefer the term TREASURE HUNTER!
Group Icon

Joined: 20 Mar, 2008
Posts: 1,012



Thanked: 39 times
Dream Kudos: 325
My Contributions
code.gif

That should help us help you.
User is offlineProfile CardPM
+Quote Post

Martyr2
RE: VB 6 And MS Access 2003
2 Jul, 2008 - 09:27 PM
Post #3

Programming Theoretician
Group Icon

Joined: 18 Apr, 2007
Posts: 5,212



Thanked: 215 times
Expert In: C/C++, Java, VB, VB.NET, C#, PHP, Web Development, HTML & CSS, Javascript

My Contributions
After your line rec.CursorType = adOpenDynamic try adding the following line...

vb

rec.LockType = adLockOptimistic


What we are doing with this is changing the locktype on the recordset to optimistic locking or locking of a record only during an update. I think you were bumping into a bigger lock and it was preventing you from doing the edit.

See if that works for you. smile.gif

"At DIC we be optimistic locking code ninjas... we even locked skyhawk out of the house in his underwear once. It was pretty hilarious." decap.gif
User is online!Profile CardPM
+Quote Post

no2pencil
RE: VB 6 And MS Access 2003
2 Jul, 2008 - 09:32 PM
Post #4

My fridge be runnin OH NOEZ!
Group Icon

Joined: 10 May, 2007
Posts: 6,463



Thanked: 66 times
Dream Kudos: 2425
Expert In: Goofing Off

My Contributions
QUOTE(Martyr2 @ 3 Jul, 2008 - 01:27 AM) *

"At DIC we be optimistic locking code ninjas... we even locked skyhawk out of the house in his underwear once. It was pretty hilarious." decap.gif

What made it even funnier was that it was during the biker rally. crazy.gif
User is online!Profile CardPM
+Quote Post

Martyr2
RE: VB 6 And MS Access 2003
2 Jul, 2008 - 09:36 PM
Post #5

Programming Theoretician
Group Icon

Joined: 18 Apr, 2007
Posts: 5,212



Thanked: 215 times
Expert In: C/C++, Java, VB, VB.NET, C#, PHP, Web Development, HTML & CSS, Javascript

My Contributions
Yeah "Bubba" had fun with him. He still never talks about that night. I assume he was violated multiple times. Burying those feelings are bad. He just may explode on us one day and then we will be famous because we will be all over CNN.
User is online!Profile CardPM
+Quote Post

no2pencil
RE: VB 6 And MS Access 2003
2 Jul, 2008 - 09:41 PM
Post #6

My fridge be runnin OH NOEZ!
Group Icon

Joined: 10 May, 2007
Posts: 6,463



Thanked: 66 times
Dream Kudos: 2425
Expert In: Goofing Off

My Contributions
A reporter will sound something like :

"Witness close to him say 'He always was the quite type'... back to you in the studio"

User is online!Profile CardPM
+Quote Post

FranZiZ
RE: VB 6 And MS Access 2003
3 Jul, 2008 - 10:20 PM
Post #7

New D.I.C Head
*

Joined: 3 Jul, 2008
Posts: 2

huh??

umm

i need help

how to call database

if i have 1 form (login form), i want to login, but i'cant call and cek database


i need help

Thank before hand

User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic
Time is now: 12/2/08 05:45PM

Live VB Help!

VB Tutorials

Reference Sheets

VB Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month