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

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




vb6 and access2007

 
Reply to this topicStart new topic

vb6 and access2007, saving records

martine2008
post 2 Apr, 2008 - 07:46 AM
Post #1


New D.I.C Head

*
Joined: 2 Apr, 2008
Posts: 2

Hi,

im using vb6 and access 2007 on vista windows. my problem is when i save a record, the record is saved. when im going to save another one it'll save it but it will remove the previous one i saved.
this is the code im using for the SAVE

vb

If Not IsNumeric(Text1.Text) Then
MsgBox "Crew ID must be numbers only", vbCritical
Text1.SetFocus
End If

Recstr = "select * from addcrew"
adoCrew.Open Recstr, ConConnect, adOpenDynamic, adLockPessimistic
With adoCrew
.AddNew

.Fields("crewid") = Text1.Text
.Fields("lastName") = Text2.Text
.Fields("firstName") = Text3.Text
.Fields("crewstatus") = Text4.Text
.Fields("phone") = Text7.Text
.Fields("email") = Text5.Text
.Fields("Comments") = Text6.Text

MsgBox ("Record saved successfully.")
End With


as you can see it's a simple couple of lines. is there anything im missing?
thank you in advance for any help

m.e. mad.gif

This post has been edited by PsychoCoder: 2 Apr, 2008 - 08:06 AM
User is offlineProfile CardPM

Go to the top of the page

MRJ
post 2 Apr, 2008 - 08:14 AM
Post #2


D.I.C Head

Group Icon
Joined: 13 Oct, 2007
Posts: 83



Thanked 1 times
My Contributions


It's been a while sence I used vb6 but I think you need to call an update when you are done saving.

So it would look something like this:

CODE

With adoCrew  
    .AddNew  
    
  .Fields("crewid") = Text1.Text  
  .Fields("lastName") = Text2.Text  
  .Fields("firstName") = Text3.Text  
  .Fields("crewstatus") = Text4.Text  
  .Fields("phone") = Text7.Text  
  .Fields("email") = Text5.Text  
  .Fields("Comments") = Text6.Text  
  
  .Update

  MsgBox ("Record saved successfully.")  
End With  
User is offlineProfile CardPM

Go to the top of the page

martine2008
post 2 Apr, 2008 - 04:32 PM
Post #3


New D.I.C Head

*
Joined: 2 Apr, 2008
Posts: 2

yes i missed that one. i don't know but had it like that when i ran it the first time but it's working now.
thank you for your reply

This post has been edited by PsychoCoder: 2 Apr, 2008 - 06:06 PM
User is offlineProfile CardPM

Go to the top of the page

Fast ReplyReply to this topicStart new topic
Time is now: 11/21/08 08:28PM

Live VB Help!

VB Tutorials

Reference Sheets

VB Snippets

Bye Bye Ads

Free DIC T-Shirt

T-Shirt Example

Related Sites

Monthly Drawing

Thumb Drive

Partners

Top Contributors

Top 10 Kudos This Month