A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » New Users
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

I want the initial Query to be from VBA Code



 
 
Thread Tools Display Modes
  #1  
Old May 17th, 2004, 11:07 AM
Sam
external usenet poster
 
Posts: n/a
Default I want the initial Query to be from VBA Code

I am developing an access application, the first time a I load a form
data is retireved from the base query. I deally i would want to change
this so that the form loads with and dispals data from VBA code (my
query will be in VBA). How do I go about doing this? I have tried to pu
the code on the on load and open form but it still doesnt work.

Your help will be apprecited.

Regards,

  #2  
Old May 17th, 2004, 01:56 PM
Cheryl Fischer
external usenet poster
 
Posts: n/a
Default I want the initial Query to be from VBA Code

The following will work in the On Open event of a form:

Me.RecordSource = "Select * from [MyTable] where [MyTable].[LastName] = "
& Chr(34) & "Smith" & Chr(34)

You have not posted your code, so we cannot comment ... However, you might
want to take the SQL portion of it and run it directly as a query (outside
of the form) to see if it returns records.


--

Cheryl Fischer, MVP Microsoft Access



"Sam" wrote in message
...
I am developing an access application, the first time a I load a form
data is retireved from the base query. I deally i would want to change
this so that the form loads with and dispals data from VBA code (my
query will be in VBA). How do I go about doing this? I have tried to pu
the code on the on load and open form but it still doesnt work.

Your help will be apprecited.

Regards,



 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 07:03 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.