Creating QueryDefs in Access 2000



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
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
Also note that the data type the function returns is defined as Boolean

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.

Ken Snell \(MVP\)

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

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