error message: can't find project library

mana

Registered User.
Local time
Today, 06:39
Joined
Nov 4, 2014
Messages
265
hello
i have the following code and i have the below error:
can't find the project or library in red part
can you help me please?


Code:
Option Compare Database
Option Explicit
Function DatumUmwandeln(Datumstring As Variant) As String
Dim Monat, Tag, Jahr As String
If Datumstring <> "" Then
    Tag =[COLOR=red] Format$[/COLOR](Datumstring, "dd")
    Monat = Format$(Datumstring, "mm")
    Jahr = Format$(Datumstring, "yyyy")
    DatumUmwandeln = "#" & Monat & "/" & Tag & "/" & Jahr & "#"
  Else
    DatumUmwandeln = "#12/12/9999#"
End If
End Function
[COLOR=red][/COLOR]
[COLOR=red]Function Repupdate()[/COLOR]
    Dim db As Database, rs2, rs6, rs_FT As Recordset
    Set db = CurrentDb
    Set rs2 = db.OpenRecordset("select * from akt_fehlteile where halle = 2")
    Set rs6 = db.OpenRecordset("select * from akt_fehlteile where halle = 6")
    Set rs_FT = db.OpenRecordset("select * from akt_fehlteile where stüli_fehler = true")
    If rs2.RecordCount > 0 Then
        Forms!fehlteil2!HALLE2.Enabled = True
      Else
         Forms!fehlteil2!HALLE2.Enabled = False
    End If
     If rs6.RecordCount > 0 Then
        Forms!fehlteil2!HALLE6.Enabled = True
      Else
         Forms!fehlteil2!HALLE6.Enabled = False
    End If
    If rs_FT.RecordCount > 0 Then
        Forms!fehlteil2!STÜLI_FEHLER.Enabled = True
      Else
        Forms!fehlteil2.STÜLI_FEHLER.Enabled = False
    End If
    Forms!fehlteil2.ActiveXStr24.SetFocus
    Forms!fehlteil2.ActiveXStr24.Value = Date
    Forms!fehlteil2!Teilenummer.SetFocus
   rs_FT.Close
   rs2.Close
   rs6.Close
   db.Close
End Function
Function Formupdate()
If Forms!fehlteil2!Suche = "" Or IsNull(Forms!fehlteil2!Suche) = True Then
    Forms!fehlteil2!Delete_Part.Enabled = False
    Forms!fehlteil2!Aktualisieren.Enabled = False
  Else
     Forms!fehlteil2!Delete_Part.Enabled = True
    Forms!fehlteil2!Aktualisieren.Enabled = True
 End If
 If Not Forms!fehlteil2!Nachbau Then
    Forms!fehlteil2!Nachb_Bem.Enabled = False
 End If
End Function
 
hello

can someone help me in this case?
my file is mdb and i don't know how can i open it like accdb file?`
can someone help me please?
 
in your mdb vba screen, select tools>references

Can't remember what the references of mdb's are but in accdb, as a minimum you should have

Visual Basic for Applications
Microsoft Access XX.0 Object Library
OLE Automation

If one of these is missing, scroll down the list until you find it, tick the box and then OK

The other thing wrong with your code is you are not declaring variables correctly

Dim db As Database, rs2, rs6, rs_FT As Recordset

of the above, only rs_FT is deciared as a recordset, the others are just objects.

You should declare as

Dim db As Database
Dim rs2 As Recordset
Dim rs6 As Recordset
Dim rs_FT As Recordset
 
Forgot to mention, but in accdb but you should also be clear about the type of database and recordset e.g.

Dim db As DAO.Database
Dim rs2 As DAO.Recordset
 
The other thing wrong with your code is you are not declaring variables correctly

Dim db As Database, rs2, rs6, rs_FT As Recordset

of the above, only rs_FT is deciared as a recordset, the others are just objects.

You should declare as

Dim db As Database
Dim rs2 As Recordset
Dim rs6 As Recordset
Dim rs_FT As Recordset

Same here:
Dim Monat, Tag, Jahr As String

Only Jahr declared as string. Other are variants
 
hello

thank you for your help,
now i have the below problem:

error message: there is no object in this control

can you helo me please?my file is a mdb file not accdb
but i didn't work with these types of files
do you know how i can open that in design or code view?
thank you
 
hello

i understood how to open it
but i have the error message in this part:

Function DatumUmwandeln(Datumstring As Variant) As String
Dim Monat, Tag, Jahr As String
If Datumstring <> "" Then
Tag = Format$(Datumstring, "dd")
Monat = Format$(Datumstring, "mm")
Jahr = Format$(Datumstring, "yyyy")
DatumUmwandeln = "#" & Monat & "/" & Tag & "/" & Jahr & "#"
Else
DatumUmwandeln = "#12/12/9999#"
End If
End Function

in tools:refrences
i have the missing as : microsoft calendar control 8.0

can you help me please?
thank you
 
in tools:refrences
i have the missing as : microsoft calendar control 8.0

I refer you to
If one of these is missing, scroll down the list until you find it, tick the box and then OK

You could try removing the $ - it is not required

you say
but i didn't work with these types of files
do you know how i can open that in design or code view?
Does this mean you are not using VBA within Access?
 
but i didn't work with these types of files
do you know how i can open that in design or code view?
:...... i can open it now



in tools:refrences
i have the missing as : microsoft calendar control 8.0 ::::: i can't find ´this refrence in refrences list

do you know what should i do?
 
sounds like you have moved from a mdb to accdb - calendar controls are not supported in accdb - instead there is a an option on the control to show the calendar
 
what do you mean

what should i do here?

sorry but i am new to vba and don not know everything
 
what did you ask those are not answered yet. can you repeat them please?
thank you
 
can you repeat them please?
please re read all the threads - suggestions have been made but we don't know if you have tried them and there is little point in moving on until you do
 

Users who are viewing this thread

Back
Top Bottom