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

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...

[INDENT]With DataList.Recordset
[INDENT].AddNew
!Field1 = Field1_Data
!Field2 = Field2_Data
etc...
.Update[/INDENT]
End With[/INDENT]

Luck!

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

Hi..go to prorties of each text box tht u hv added in the form in that go to datasource click and selct data source and in data field select the rows of database u hv created

This article has been dead for over six months. Start a new discussion instead.