Hi All,
Id like to ask a couple of questions about QueryDef parameters. Im looking blankly at a few help sheets online…
The first is how do I set the parameter? The below is what I've been working with but its not working
The second is how di I refer to the parameter in the SQL? I have the below SQL for example, but how do I include the parameter?
I hope ive made sense here – Thanks for looking!
Id like to ask a couple of questions about QueryDef parameters. Im looking blankly at a few help sheets online…
The first is how do I set the parameter? The below is what I've been working with but its not working
Code:
[SIZE=3][COLOR=#000080][FONT=Arial]Dim db As DAO.Database[/FONT][/COLOR][/SIZE]
[SIZE=3][COLOR=#000080][FONT=Arial]Set db = CurrentDb[/FONT][/COLOR][/SIZE]
[SIZE=3][COLOR=#000080][FONT=Arial]Dim QDF As DAO.QueryDef[/FONT][/COLOR][/SIZE]
[SIZE=3][COLOR=#000080][FONT=Arial]Set QDF = db.QueryDefs("qry_MyQRY")[/FONT][/COLOR][/SIZE]
[SIZE=3][COLOR=#000080][FONT=Arial]Dim SAISQL As String[/FONT][/COLOR][/SIZE]
[SIZE=3][COLOR=#000080][FONT=Arial]QDF.Parameters("MyPara") = [Forms]![frm_Main]![M_subfrm].[Form].[S_subfrm].[Form].[lst1].Value[/FONT][/COLOR][/SIZE]
The second is how di I refer to the parameter in the SQL? I have the below SQL for example, but how do I include the parameter?
Code:
[SIZE=3][COLOR=#000080][FONT=Arial]SELECT tbl_MyTbl.Field1[/FONT][/COLOR][/SIZE]
[SIZE=3][COLOR=#000080][FONT=Arial]FROM tbl_MyTbl[/FONT][/COLOR][/SIZE]
[SIZE=3][COLOR=#000080][FONT=Arial]WHERE (((tbl_MyTbl.Field1)=[Forms]![frm_MyForm]![subfrm].[Form]![cbo2])); [/FONT][FONT=Wingdings][FONT=Wingdings]ß[/FONT][/FONT][FONT=Arial]How do I set this to read the parameter?[/FONT][/COLOR][/SIZE]
I hope ive made sense here – Thanks for looking!