Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ADO and Datagrid 1

Status
Not open for further replies.

deva1

Programmer
Oct 28, 2002
27
US
Hi All,

I am a beginner.I am just attaching the code.I do not know the exact problem.It gives an error message while running.

The error is

Run_time error '7004'
The rowset is not bookmarkable.

I am attaching the code.

Dim Currinv_Rec As New ADODB.Recordset


Private Sub Form_Load()
Set Currinv_Rec = New ADODB.Recordset
Currinv_Rec.Open "select * from sys_current_invoice", "Provider=SQLOLEDB.1;Password=test;Persist Security Info=True;User ID=sa;Initial Catalog=testpubtest;Data Source=TEST\NKTEST", adOpenDynamic, adLockOptimistic, adcmdtxt


Set DataGrid1.DataSource = Currinv_Rec

end sub




The file "sys_current_invoice" does not have any records.Is that the problem?


Thanks alot for help.


 
You said: The file "sys_current_invoice" does not have any records.Is that the problem?

That's a good bet. Try adding a test for an empty recordset before assigning it to a DataSource:
Code:
If not (Currinv_Rec.BOF and Currinv_Rec.EOF) then
  Set DataGrid1.DataSource = Currinv_Rec
Else
  ' pop up a message box that there's no data or something
End If

HTH,
David
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top