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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Dim db As Database

Status
Not open for further replies.

simoncpage

Programmer
Apr 4, 2002
256
GB
Which reference do I need to add for Dim db As Database to be recognised?

Thanks

Simon
 
I have already tried that that was the first one I added! I have dao 3.6 object library but that shouldn't make a difference should it?
I am going to use ado now as that works. (although I would still like to get dao working) any ideas why its not working?
 
WHY ?

As in: WHY use the old, out of date DAO when you have access to the new, modern, supported, recommended, more flexible, more advanced, more user friendly ADO ??


If you have Access 2000 with ADO referenced you may well find that you have to 'unreference' some of the ADO to get Dim db as Database working again.
I seem to remember reading something about this before - but as it is not something I'dd do by preference, it's not something I've come across often.


Oh, and by the way - WHY are you doing this ?


G LS

 
Just setting up a userfrom query from excel and word to a database. WIth ado you can't as far as I know retrieve a recordset object and lists information about the users (shared db)?
 
G LS can you help with this? I have a form called startform and a textbox on it called txtdatabase I want to have the sql where to be the value of the txtdatabase not sure what I have done wrong???

.Open "SELECT * FROM contacts WHERE [ident] = " & Startform.txtdatabase.Value & ", cn, , , adCmdText ' filter records from startform value

 
in ADO

Dim rst As ADODB.RecordSet
Set rst = New ADODB.RecordSet
rst.ActiveConnection = CurrentProject.Connection
rst.LockType = adLockOptimistic
rst.CursorType = adOpenKeyset

rst.Open "SELECT * FROM contacts WHERE [ident] = " & Forms!StartForm.txtdatabase " ,,,, adCmdText

I think is what you need.
It is the Forms! before the startForm that you were missing - but that would have been needed in DAO as well.




G LS
 
It actually works with out forms! I managed to do it thanks though!!

Simon
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top