Re: Change Query SQL Programatically
From: Allen Browne (AllenBrowne_at_SeeSig.Invalid)
Date: 12/16/04
- Next message: accessquestion: "Form in Data*** view"
- Previous message: Barry: "Parameter query"
- In reply to: AlCamp: "Change Query SQL Programatically"
- Next in thread: John Vinson: "Re: Change Query SQL Programatically"
- Messages sorted by: [ date ] [ thread ]
Date: Thu, 16 Dec 2004 12:34:36 +0800
Try something like this:
CurrentDb.QueryDefs("MyQuery").SQL = "SELECT * FROM MyTable;"
Of couse, you could also set the RecordSource of the report itself in its
Open event:
Private Sub Form_Open(Cancel As Integer)
Me.RecordSource = "SELECT * FROM MyTable;"
End Sub
-- Allen Browne - Microsoft MVP. Perth, Western Australia. Tips for Access users - http://allenbrowne.com/tips.html Reply to group, rather than allenbrowne at mvps dot org. "AlCamp" <anon@anon.net> wrote in message news:%23X2zSWy4EHA.1292@TK2MSFTNGP10.phx.gbl... >I need to change the SQL statement for a saved query "on the fly". > I'd be using the OnOpen event of a report, if that's possible. > > I checked out the properties for queries, and can't seem to find anything > to hang my hat on. > > Is this possible? Could someone get me going in the right direction, or > refer me to information as to how this might be done? > > Thanks, > Al Camp
- Next message: accessquestion: "Form in Data*** view"
- Previous message: Barry: "Parameter query"
- In reply to: AlCamp: "Change Query SQL Programatically"
- Next in thread: John Vinson: "Re: Change Query SQL Programatically"
- Messages sorted by: [ date ] [ thread ]