Dears, good morning!
I want to put a password by type of day of the week in LibreOffice Base, using the IF, inside a module.
Is it possible through programming?
Thank you!
Dears, good morning!
I want to put a password by type of day of the week in LibreOffice Base, using the IF, inside a module.
Is it possible through programming?
Thank you!
Hello,
A password to do what? Database access? This is not a Base function. Database used (not mentioned in question) determines password usage. Password for locking out macro access? Or something else?
Hello! I couldn’t explain …
I use code to open the database forms, like a password, like this.
What I try to know is if there is how I can make this code changed, according to the day of the week, that is, if it is Monday, code X, if it is Tuesday, code Y, and so on.
Very grateful for the return.
Sub abrirformulario
Dim ObjTypeWhat
Dim ObjName as String
Dim Senha as String
Senha=Inputbox("Entre")
ObjName="frm_Principal"
ObjTypeWhat=com.sun.star.sdb.application.DatabaseObject.FORM
If Senha = "2468" then
If ThisDataBaseDocument.FormDocuments.hasbyname(ObjName) Then
ThisDataBaseDocument.currentcontroller.connect()
ThisDataBaseDocument.currentcontroller.loadComponent (ObjTypeWhat, ObjName, FALSE)
Else
MsgBox "Erro ao abrir o formulário"
End if
Else
ThisDatabaseDocument.Close(True)
End if
End Sub
Hello,
Based upon comment, you are looking to determine what day of the week it is today. You can find that out with a WEEKDAY function. See WEEKDAY for options.
So keep in mind with basic the code for today is:
iToday = WEEKDAY(NOW())
If you want to start the day of the week on Monday = 1, then:
iToday = WEEKDAY(NOW(),2)
Your return is an integer which can be used in your code like:
If (WEEKDAY(NOW(),2) = 5) AND (Senha = "2468") then Print "ALL is OK!"
Dears, good morning!
That’s exactly what I need! Thank you!
For me the issue is resolved.
Hugs!
As with all questions and as you have been helped, please help others to know the question has been answered by clicking on the in upper left area of answer which satisfied the question.