Compile Error: User-defined type not defined 
Author Message
 Compile Error: User-defined type not defined

As a result of some strange error messages i got, I was adviced to create a
new database and import my old one into this. And it worked, my code (the
one that gave med problems) ran smoothly afterwards.

But this seems to have caused other problems. The following code will not
run and Visual Basic gives the error in the subject line (the first line
gets marked yellow and "db As Database" in the second line gets marked as it
would have been if it was done by the mouse):

Private Sub btnExtractFaktura_Click()
Dim db As Database
Dim frm As Form, ctl As Control, ctl1 As Control
Dim varItem As Variant
Dim strSQL As String
Dim intCol As Integer
Dim strFakturaStatus As String

    Set db = CurrentDb
    Set frm = Forms!FakturaRegisterGruppe
    Set ctl = frm!lstSendGruppeFaktura
    Set ctl1 = frm!FakturaStatus
    strFakturaStatus = "Overf?rt Fakturaregister"

    If ctl.ItemsSelected.Count = 0 Then Exit Sub
    ctl1 = strFakturaStatus
    For Each varItem In ctl.ItemsSelected
        strSQL = "INSERT INTO FakturaRegister (GruppeFakturaID, MedlemsID,
FakturaNavn, FakturaAdresse, FakturaPostNR, FakturaPoststed, FakturaDato,
FakturaBel?p, BetalingsInfoKort, BetalingsInfoLang, BetalingsFrist,
FakturaStatus)" & _
        " VALUES (" & frm.GruppeFakturaID & "," & ctl.Column(0, varItem) &
",'" & ctl.Column(1, varItem) & _
        "','" & ctl.Column(2, varItem) & "','" & ctl.Column(3, varItem) &
"','" & ctl.Column(4, varItem) & _
        "','" & frm.FakturaDato & "'," & frm.FakturaBel?p & ",'" &
frm.BetalingsInfoKort & _
        "','" & frm.BetalingsInfoLang & "','" & frm.BetalingsFrist & "','" &
frm.FakturaStatus & "')"
        db.Execute strSQL, dbFailOnError
    Next varItem

End Sub

My old database has the same code and here it works fine. Any ideas on
what's wrong??

Thanks a lot!

Regards
Asbj?rn S?bye



Wed, 06 Jul 2005 08:25:40 GMT  
 Compile Error: User-defined type not defined

Quote:

>As a result of some strange error messages i got, I was adviced to create a
>new database and import my old one into this. And it worked, my code (the
>one that gave med problems) ran smoothly afterwards.

>But this seems to have caused other problems. The following code will not
>run and Visual Basic gives the error in the subject line (the first line
>gets marked yellow and "db As Database" in the second line gets marked as it
>would have been if it was done by the mouse):

It sounds like you forgot to set the new db's references?

--
Marsh
MVP [MS Access]



Wed, 06 Jul 2005 11:34:50 GMT  
 Compile Error: User-defined type not defined
You need to add the Microsoft Data Access Object (DAO) 3.6 Library to the
Refernces Collection.  While you at it, remove the ADO 2.X Library from the
References if you are not using ADO.

HTH
Van T. Dinh
MVP (Access)


Quote:
> As a result of some strange error messages i got, I was adviced to create
a
> new database and import my old one into this. And it worked, my code (the
> one that gave med problems) ran smoothly afterwards.

> But this seems to have caused other problems. The following code will not
> run and Visual Basic gives the error in the subject line (the first line
> gets marked yellow and "db As Database" in the second line gets marked as
it
> would have been if it was done by the mouse):

> Private Sub btnExtractFaktura_Click()
> Dim db As Database
> Dim frm As Form, ctl As Control, ctl1 As Control
> Dim varItem As Variant
> Dim strSQL As String
> Dim intCol As Integer
> Dim strFakturaStatus As String

>     Set db = CurrentDb
>     Set frm = Forms!FakturaRegisterGruppe
>     Set ctl = frm!lstSendGruppeFaktura
>     Set ctl1 = frm!FakturaStatus
>     strFakturaStatus = "Overf?rt Fakturaregister"

>     If ctl.ItemsSelected.Count = 0 Then Exit Sub
>     ctl1 = strFakturaStatus
>     For Each varItem In ctl.ItemsSelected
>         strSQL = "INSERT INTO FakturaRegister (GruppeFakturaID, MedlemsID,
> FakturaNavn, FakturaAdresse, FakturaPostNR, FakturaPoststed, FakturaDato,
> FakturaBel?p, BetalingsInfoKort, BetalingsInfoLang, BetalingsFrist,
> FakturaStatus)" & _
>         " VALUES (" & frm.GruppeFakturaID & "," & ctl.Column(0, varItem) &
> ",'" & ctl.Column(1, varItem) & _
>         "','" & ctl.Column(2, varItem) & "','" & ctl.Column(3, varItem) &
> "','" & ctl.Column(4, varItem) & _
>         "','" & frm.FakturaDato & "'," & frm.FakturaBel?p & ",'" &
> frm.BetalingsInfoKort & _
>         "','" & frm.BetalingsInfoLang & "','" & frm.BetalingsFrist & "','"
&
> frm.FakturaStatus & "')"
>         db.Execute strSQL, dbFailOnError
>     Next varItem

> End Sub

> My old database has the same code and here it works fine. Any ideas on
> what's wrong??

> Thanks a lot!

> Regards
> Asbj?rn S?bye



Wed, 06 Jul 2005 12:19:16 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Compile Error - User defined type not defined

2. Compile Error - User-Defined type not defined

3. Compile error: User-defined type not defined

4. Compile error: User-defined data type not defined!

5. Microsoft Visual Basic Compile Error: Uder-defined type not defined

6. User-Defined type not defined error (MAPI.Session)

7. user defined type not defined error help please

8. User-Defined type not defined error (MAPI.Session)

9. ComctlLib; compiler error: User-defined type not defined

10. Help!!-NEWBIE - Application Wizard -(WROX BOOK) Error- User defined type not defined

11. Error: User-defined type not defined

12. Help!!-NEWBIE - Application Wizard -(WROX BOOK) Error- User defined type not defined

 

 
Powered by phpBB® Forum Software