Error message due to empty row, (VB6-ADO-ACCESS)

Please support our Visual Basic 4 / 5 / 6 advertiser: Programming Forums - DaniWeb Sister Site
Reply

Join Date: May 2008
Posts: 3
Reputation: peroberg is an unknown quantity at this point 
Solved Threads: 0
peroberg peroberg is offline Offline
Newbie Poster

Error message due to empty row, (VB6-ADO-ACCESS)

 
0
  #1
Jun 7th, 2008
Question TWO
I have on and off been using Basic, now VB since “the stone age” long before Microsoft and Windows. However it is only now I enter the issue of using VB6 and a database. I use VB6-ADO-ACCESS plus using DataGrid as the main view to see the database. I use 5 tables with some info in one table to be used in another. Hope it is OK to ask few questions but will put them one by one:

2. I have a button that with the code: DataList.Recordset.AddNew
But if I do not want to fill in the info in runtime I get an error message: "Empty row cannot be inserted.Row must have at least one column value set." Any suggestions?

Per
Reply With Quote Quick reply to this message  
Join Date: Jun 2008
Posts: 1
Reputation: PeterRoscoe is an unknown quantity at this point 
Solved Threads: 0
PeterRoscoe PeterRoscoe is offline Offline
Newbie Poster

Re: Error message due to empty row, (VB6-ADO-ACCESS)

 
0
  #2
Jun 7th, 2008
Originally Posted by peroberg View Post
Question TWO

2. I have a button that with the code: DataList.Recordset.AddNew
But if I do not want to fill in the info in runtime I get an error message: "Empty row cannot be inserted.Row must have at least one column value set." Any suggestions?

Per
The AddNew command just moves the cursor to a new record. you must then add your data to the fields and then save the record. You will want to have the new data ready to go:

Field1_Data = InputBox("Field1")
Field2_Data = InputBox("Field2")
etc...

Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
  1. <blockquote>With DataList.Recordset<blockquote>.AddNew
  2. !Field1 = Field1_Data
  3. !Field2 = Field2_Data
  4. etc...
  5. .Update</blockquote>End With</blockquote>

Luck!
Reply With Quote Quick reply to this message  
Join Date: May 2008
Posts: 3
Reputation: peroberg is an unknown quantity at this point 
Solved Threads: 0
peroberg peroberg is offline Offline
Newbie Poster

Re: Error message due to empty row, (VB6-ADO-ACCESS)

 
0
  #3
Jun 8th, 2008
OK, thanks however was not able to get it right.

Gets error "Expected Function or variable".

Marked is "Private Sub ..." with yellow and
marked with blue is on the first line ".AddNew"

So what have I missed?

Have a nice day
Per
Reply With Quote Quick reply to this message  
Join Date: Feb 2008
Posts: 513
Reputation: selvaganapathy is an unknown quantity at this point 
Solved Threads: 89
selvaganapathy's Avatar
selvaganapathy selvaganapathy is offline Offline
Posting Pro

Re: Error message due to empty row, (VB6-ADO-ACCESS)

 
0
  #4
Jun 8th, 2008
Hi,
Can u post your coding to view somebody to tell the suggestions.
KSG
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Other Threads in the Visual Basic 4 / 5 / 6 Forum
Thread Tools Search this Thread



Tag cloud for Visual Basic 4 / 5 / 6
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC