
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