Näytetään tekstit, joissa on tunniste forms. Näytä kaikki tekstit
Näytetään tekstit, joissa on tunniste forms. Näytä kaikki tekstit

torstai 30. elokuuta 2007

CurrentUser Function

In Access, the CurrentUser function returns the name of the current Access user. In a secured database, this would be the name of the user who has logged in. If the database is unsecured, this function would return Admin (the default account) as the name of the user.

The syntax for the CurrentUser function is:

CurrentUser()

VBA Code
The CurrentUser function can be used in VBA code. For example:

Dim LUser As String
LUser = CurrentUser()


In this example, the variable called LUser would now contain the name of the user currently logged into the Access database.

SQL/Queries
You can also use the CurrentUser function in a query.

keskiviikko 29. elokuuta 2007

Howto INSERT from MS Access forms

' AutoNumber field is updated automatically if one exists
Private Sub Command1_Click()
Dim SQLI As String
SQLI = "INSERT INTO MYMOVIES ([GENRE],[NAME],[PRODUCTIONYEAR]) " & _

"values ('" & Forms!AddMovie!Genre & "'," & Forms!AddMovie!Name & _
"," & Forms!AddMovie!ProductionYear & "');"
DoCmd.RunSQL SQL_InsertFilm
Response = MsgBox("You added ' " & Forms!AddMovie!FilmName & " '.")
End Sub

tiistai 28. elokuuta 2007

MsgBox

Response = MsgBox("ComboCat1=" & Forms!AddDrawing!ComboCat1 & vbCrLf & "ComboCat2=" & Forms!AddDrawing!ComboCat2)

keskiviikko 22. elokuuta 2007

Dateformats in MS ACCESS Forms

Between DateValue([Forms]![SearchForm]![txtDueDateA]) And DateValue([Forms]![SearchForm]![txtDueDateB])

is usable for coverting strings to date for SQL.