|
-
Oct 7th, 2008, 08:19 AM
#4
Thread Starter
Hyperactive Member
Re: [Access 2003] Form Data Source
Hi Hack,
My data source has a total of five fields, Date, Action, User, IDCode and Value.
My form needed to display the list of IDCode and Value entries for Date,
Action and User, I could have 1 to 20 entries with different IDCodes.
Hi Davadvice,
Many thanks for the advice, I was able to test the following code which works, will now be able to adapt my real code..
Code:
Sub ReQuery()
Dim QuerySqlStr As String
QuerySqlStr = "SELECT Table1.Date, Table1.User, Table1.Results, Table1.Value " & _
"FROM Table1 " & _
"WHERE Table1.Date=#" & Format(Form_Form1.TxtDate.Value, "yyyy/mm/dd") & "# AND Table1.User='" & Form_Form1.TxtName.Value & "'"
CurrentDb.QueryDefs.Delete "Query1"
CurrentDb.CreateQueryDef "Query1", QuerySqlStr
Form_Form1.LblQuery.Caption = QuerySqlStr
Form_Form1.RecordSource = QuerySqlStr
End Sub
Signature Under Construction 
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|