DAO or ADO assigning recordset to me. recordset

  • Thread starter Thread starter Miguel
  • Start date Start date
M

Miguel

I am trying to assign a recordset in Access 2000 to the
current form:

Private Sub Form_Load()
General.InitConnect
strsql = "select * from contractor where
contactfirstname='Miguel'"

Dim rs As Recordset
Set rs = cnn.OpenRecordset(strsql, dbOpenDynaset, 0,
dbOptimistic)
Set Me.Recordset = rs


End Sub

Every time this runs it causes a fatal error.

What's wrong. How do I assign the recordset to fields so
that I can see the value. Can I enter in the control source
Me.Recordset.Fields("ContactFirstName").Value for any
given text box.

Really I would like to perform a full text query using the
contains clause or a stored procedure on SQL Server and
return all the results to a form in a datasheet view. Is
this possible?

I was thinking I could just find a grid control that
supports the adodb recordset natively.

Thanks,
Miguel
 
Why don't you just stuff the whole sql right into the forms record source?

It is quick, easy, and is the least amount of code.

Try:

me.RecordSource = "select * from contractor where contactfirstname='Miguel'"

I count one line of code!

Further, if you need a grid that lets you edit, then just use a continuous
form.

Check out the following screen shots:

http://www.attcanada.net/~kallal.msn/Articles/Grid.htm
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top