4 Replies - 4637 Views - Last Post: 14 June 2012 - 10:13 AM Rate Topic: -----

#1 ChapMan  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 11
  • Joined: 02-June 12

VB 6.0 run time error 3021

Posted 13 June 2012 - 03:45 PM

My vb code for saving is giving the error message run time error 3021 below is the code generating the error
Private Sub cmdSave_Click()
 
ValidateInputs_Click
With Adodbconn.Recordset
.Fields("Fname") = txtFName.Text
.Fields("sname") = txtSname.Text
.Fields("sex") = CmboSex.Text
.Fields("Job") = CmboJob.Text
.Fields("address") = txtAddress.Text
.Fields("contNo") = TxtcontactNo.Text
.Fields("AcctNo") = TxtAcctNo.Text
.Fields("Ldate") = TxtDate.Text
.Fields("LoanAmt") = Amount.Text
.Fields("Lduration") = CmboDmth.Text
.Fields("Mpayment") = txtPmt.Text
.Fields("GFname") = txtGfname.Text
.Fields("GSname") = txtGsname.Text
.Fields("Gaddress") = TxtGAddr.Text
.Fields("GContNo") = TxtcontactNo.Text
.Fields("Gsex") = CmboGsex.Text
.Fields("GJob") = CmboGJob.Text
MsgBox "updated"


End With
CmdSave.Visible = False
CmdNew.Visible = True
End Sub


Is This A Good Question/Topic? 0
  • +

Replies To: VB 6.0 run time error 3021

#2 GunnerInc  Icon User is offline

  • "Hurry up and wait"
  • member icon




Reputation: 858
  • View blog
  • Posts: 2,277
  • Joined: 28-March 11

Re: VB 6.0 run time error 3021

Posted 13 June 2012 - 03:45 PM

Moved to VB6
Was This Post Helpful? 0
  • +
  • -

#3 BobRodes  Icon User is offline

  • Your Friendly Local Curmudgeon
  • member icon

Reputation: 574
  • View blog
  • Posts: 2,989
  • Joined: 19-May 09

Re: VB 6.0 run time error 3021

Posted 13 June 2012 - 05:10 PM

Since I'm in a good mood, I looked up which error 3021 was. Normally, I'd ask you to do it yourself! As if we all have those numbers memorized. Normally, I'd also ask you which line of code was causing the error, too. In future, please provide those pieces of information when you ask us to troubleshoot an error.

However, the reason that you are getting that error is because the recordset doesn't know where to put the values you're trying to plug into it, because there is no current record. Why do you think that might be?
Was This Post Helpful? 2
  • +
  • -

#4 ChapMan  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 11
  • Joined: 02-June 12

Re: VB 6.0 run time error 3021

Posted 14 June 2012 - 09:17 AM

The error number 3021 has the following message (run time error 3021 either bof or eof is true, or the current records has been deleted, requested operation requires a current record)
in fact the error runs through all the line of codes.
Counting on your support
Was This Post Helpful? 0
  • +
  • -

#5 BobRodes  Icon User is offline

  • Your Friendly Local Curmudgeon
  • member icon

Reputation: 574
  • View blog
  • Posts: 2,989
  • Joined: 19-May 09

Re: VB 6.0 run time error 3021

Posted 14 June 2012 - 10:13 AM

No, it doesn't. It only runs through lines 5 through 21, right? And again, why do you think that is? I'll give you a hint: because there's no current record. Why do you think that is?
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1