2 Replies - 3337 Views - Last Post: 02 October 2009 - 07:35 AM Rate Topic: ***** 1 Votes

#1 ravmonster  Icon User is offline

  • D.I.C Head

Reputation: 2
  • View blog
  • Posts: 162
  • Joined: 20-July 09

USER-DEFINED TYPE

Posted 02 October 2009 - 06:34 AM

hi..

i'm having a problem connecting my .mdb to VB
here is my CODE


Option Explicit

Private mobjConn As ADODB.Connection  ////user defined
Private mobjCmd  As ADODB.Command   ////user defined
Private mobjRst	As ADODB.Recordset	  ////user defined



Private Sub ConnectToDB()
	Set mobjConn = New ADODB.Connection
	mobjConn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;" _
							  & "Data Source=" _
							  & GetAppPath _			  ///GetappPath is on a MODULE
							  & "Equipment.mdb"
	mobjConn.Open

	Set mobjCmd = New ADODB.Command
	Set mobjCmd.ActiveConnection = mobjConn
	mobjCmd.CommandType = adCmdText

End Sub

Private Sub Form_Load()
ConnectToDB
End Sub




it Shows an error "User-defined type not defined"...
can anyone tell me why is it showing an error like that...
and how to fix this error...
THNX THNX THNX :) :) :) :) :)

This post has been edited by ravmonster: 02 October 2009 - 06:41 AM


Is This A Good Question/Topic? 0
  • +

Replies To: USER-DEFINED TYPE

#2 magius96  Icon User is offline

  • D.I.C Addict
  • member icon

Reputation: 71
  • View blog
  • Posts: 789
  • Joined: 15-April 09

Re: USER-DEFINED TYPE

Posted 02 October 2009 - 07:16 AM

ravmonster,

Unfortunately I've only got MS-Access and it's VBA to work with, so I can't replicate your error, but I would definately suggest checking to make sure you have included all the necessary references.

I'm assuming since your getting this error that you are not using MS-Access to build your app, and since I don't get the error in Access, then I'd suggest making sure you add Access as a reference. That should fix your problem.

---EDIT---
"Microsoft activex data objects" may be the reference your missing

This post has been edited by magius96: 02 October 2009 - 07:19 AM

Was This Post Helpful? 0
  • +
  • -

#3 ravmonster  Icon User is offline

  • D.I.C Head

Reputation: 2
  • View blog
  • Posts: 162
  • Joined: 20-July 09

Re: USER-DEFINED TYPE

Posted 02 October 2009 - 07:35 AM

View Postmagius96, on 2 Oct, 2009 - 06:16 AM, said:

ravmonster,

Unfortunately I've only got MS-Access and it's VBA to work with, so I can't replicate your error, but I would definately suggest checking to make sure you have included all the necessary references.

I'm assuming since your getting this error that you are not using MS-Access to build your app, and since I don't get the error in Access, then I'd suggest making sure you add Access as a reference. That should fix your problem.

---EDIT---
"Microsoft activex data objects" may be the reference your missing



YES YES YES....... i forgot to include that... :D :D :D :D :D
....cheers mate... :D :D :D
THNX for the quick reply...
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1