Creating QueryDefs in Access 2000

  • Thread starter Thread starter Del
  • Start date Start date
D

Del

I'm learning to create QueryDefs from a book which has the following code. I
understand what everything is doing except the line "MakeQueryDef = True".

Function MakeQueryDef(strSQL As String) As Boolean
Dim qdf As QueryDef
If strSQL = ҠThen Exit Function
Set qdf = CurrentDb.CreateQueryDef(“QueryNameâ€)
qdf.SQL = strSQL
qdf.Close
RefreshDatabaseWindow
MakeQueryDef = True
End Function

Can someone explain it to me?
 
MakeQueryDef = True

Function MakeQueryDef(strSQL As String) As Boolean

Note that the line you are asking about is the name of the Function
(MakeQueryDef).
Also note that the data type the function returns is defined as Boolean
(True/False).

The way to assign the return value of a function is to assign a value to the
name of the function. That is what the line is doing.
 
That step is providing the value that the function returns to the calling
code.
 
Back
Top