Creating QueryDefs in Access 2000

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?
 
K

Klatuu

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.
 
K

Ken Snell \(MVP\)

That step is providing the value that the function returns to the calling
code.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top