473,586 Members | 2,682 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

viewing query subform based on text box value

25 New Member
Hai, need a help please.

i have a form to view the query subform
1. form name : form1
2. query subform name : subform1
3. textbox name : txtclass1
4. command button name : cmd1

i want to view my query based on the value in the textbox.
the field in my query are : noreg, class, M2A, M2E, M2M

if user insert the value "M2A0901" in the textbox then
Expand|Select|Wrap|Line Numbers
  1. "Select * from Query where M2A like 'M2A0901' "
if user insert the value "M2E0901" in the textbox then
Expand|Select|Wrap|Line Numbers
  1. "Select * from Query where M2E like 'M2E0901' "
and so on.

how do i have to use the runSQL statement. or maybe there is another way to view my data in the subform.

beside i already try this way for the M2A class
Expand|Select|Wrap|Line Numbers
  1. SQL1 = "Select * from query where M2A like ' "& txtclass1 &" ' "
  2.  
  3. DoCmd.RunSql SQL1
but when i running this statement there is still error said "syntax error in query, incomplete query caluse"

can anybody help me please.
thanks anyway
Apr 2 '09 #1
2 3508
Delerna
1,134 Recognized Expert Top Contributor
Is the data in the subform based off a query in the queries tab? (in relation to the table tab and the forms tab and the reports tab etc, that is)

If so you can put a reference to the textbox into the criteria for that field in the subforms query.

Then you can use the afterupdate or similar event of the textbox to execute the
Expand|Select|Wrap|Line Numbers
  1. Me.Requery
  2. Me.Refresh
statements in the main form.
Apr 2 '09 #2
dbdb
25 New Member
ok thank you.
it works
Apr 2 '09 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

8
17489
by: Dalan | last post by:
Please help - just take a quick look at the function code below. It probably just needs some minor tweaking. The function module is based on an intermediate query to provide a group record total from a subform that is posted to a field on the main form. "Everything seems to work fine" except that I consistently receive an error everytime...
2
3543
by: Pete | last post by:
Before I get started with the question, does anyone have a (single) good book recommendation for database design? Not an Access-specific book, but something geared toward helping me figure out *what the user wants*. I've had brief formal education about data flow diagramming, but I'm looking for ... more, now that I'm actually running into...
3
1011
by: cassandra.flowers | last post by:
Hi, I was wondering if it is possible (Using access) to have a query parameter as a drop down box rather than a text box? e.g. typing as criteria for a query produces a box with a text box for you to enter the parameter. Can any body enlighten me on how to turn this text box into a drop down box? And whether it is possible?
3
579
by: John young | last post by:
I have been looking for an answer to a problem and have found this group and hope you can assist . I have been re doing a data base I have made for a car club I am with and have been trying to make a query that selects from a table as desribed below .. I have a table (Volunteer) that has a member field (memnumber) and a number of fields ...
1
8453
by: John Michael | last post by:
I have a form that has a subform that has a subform. The subform loads a record based on a combo lookup box in the main form. I'm trying to set a value in the subform based on a value in a subform of the subform. the main Form is called Subform is called Subform in the subform is called
2
5771
by: Smartin | last post by:
Using Access 97 I am trying to create a form that allows for user entry of search terms and displays a table of results. I thought I could accomplish this using a subform but it isn't quite doing what I want it to do. What I have so far: Fields to enter search terms Subform bound to a query
30
3360
by: Noob | last post by:
ftp://ukcassassin:winston@www.ukcassassin.pwp.blueyonder.co.uk/htdocs/Diary%20Form.bmp Hi all I will appologise in advance for my lack of knowledge of access and its working as i am quite new to the program and have been self taught, so here goes. As you can see by the image link i am creating an appointment diary for a garage,its going ok...
1
4269
by: tomlebold | last post by:
Having problems displaying query results from combo boxes on a sub form, which is on the same form that is used to select criteria. This has always worked form me when displaying query results on another main and sub form. The requery on the sub form and refresh comands on the main form do not work when the form is first displayed and when...
23
2427
by: mforema | last post by:
Hi everybody, I need to create a query that will search based on keywords and major categories. My tables are set-up as follows: tblLiteratureArticles: Abbreviation(FK) ArticleID(PK) Author Title etc... tblArticleKeyword (Join Table btn tblLiteratureArticles & tblKeywords)
0
7912
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7839
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
8338
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
5710
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5390
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3865
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2345
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1449
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1180
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.