473,738 Members | 7,110 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Error Message for Query/Form.

36 New Member
Hi :-)

I've designed a query that gathers its information for two tables:-

1)Author and
2) Category

My selection criteria for this query is Author.AuthorNa me [Enter Author Name] and
Category.Catego ryName [Enter Category].

This query works well. However, if I do the following:

"Joe Public" as the Author and
"Faith" as the Category

If this author has books on faith then they will be shown HOWEVER

If he has none, I get a blank form or blank Datasheet view.

For the Form I desire to have some message stating there are no records
when such a situation arises (Any Help rendered would be greatly appreciated)

(Previously someone on this forum highlighted a method with search box criteria from one table and that worked fantastic. NOW I dont know how to apply this for two tables)

Thanks a Mil!
Aug 21 '09 #1
4 1678
ChipR
1,287 Recognized Expert Top Contributor
This will be easy, since it requires very little change from the previous code. You'll have two text or combo boxes for the user to enter criteria, something like txtAuthor and txtCategory. I like combo boxes usually because they autocomplete, but you probably don't want one with many, many entries. Plus with the text box, you might eventually let a user enter partial search criteria and use LIKE to match them. This shouldn't work correctly if either text box is empty or null, so you probably want to check for that.

Expand|Select|Wrap|Line Numbers
  1. Private Sub cmdSearchButton_Click() 
  2. Dim intMatches As Integer 
  3. Dim strWhereCondition As String 
  4.     strWhereCondition = "[AuthorName] = """ & txtAuthor _
  5.         & """ AND [CategoryName] = """ & txtCategory & """"
  6.     intMatches = DCount("AuthorName", "myQuery", strWhereCondition) 
  7.     If intMatches > 0 Then 
  8.         DoCmd.OpenForm "frmViewRecords", , , strWhereCondition 
  9.     Else 
  10.         MsgBox "No records found." 
  11.     End If 
  12. End Sub 
Aug 24 '09 #2
student2
36 New Member
Thanks ever so much ChipR, I'm going to look into it.
What I did in the interim was to present a message box on the form's load that would advise the user that a blank form would mean--- no records.
This I thought was unprofessional and not nice design but I did need something to advise the user and not have him/her be at a lost.

Again I thank you ever so much for your responses.
Appreciative!
C.R.
Aug 25 '09 #3
student2
36 New Member
Hi ChipR.
I tried it, however, it does not seem to be functional on my end.
If my datatype for CategoryName and AuthorName is "text" does that make a difference? (just a wild guess)
Thanks again!
C.R.
Aug 26 '09 #4
student2
36 New Member
Ok ChipR. Thanks a mil, I now got it to work.
Appears that I had line of code in an incorrect order......well all I did was adjust the order and it works thanks again :-)
Aug 26 '09 #5

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

Similar topics

3
2929
by: josh dismukes | last post by:
/// here is the code i'm getting a parse error on the last line of the code which /// is </html> any help will be much appreciated. <?php session_start ();
29
2477
by: shank | last post by:
1) I'm getting this error: Syntax error (missing operator) in query expression on the below statement. Can I get some advice. 2) I searched ASPFAQ and came up blank. Where can find the "rules" for when and how to use single quotes and double quotes in ASP? thanks! ---------------------- SQL = SQL & "WHERE '" & REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE("GenKTitles.
7
3415
by: Jack | last post by:
Hi, I am trying to test a sql statement in Access which gives me the error as stated in the heading. The sql statement is built as a part of asp login verification, where the userid and password are input in login screen. The password in the database is a number field. I am writing the dynamic sql statement as follows below. I believe I am going wrong in the password section of the code. I appreciate any help. Thanks. Regards.
4
1668
by: Bryan Tang | last post by:
I built an ASP to search the content in index server. It is ok if search in English. Whenever I search in Chinese, I will got the following error message, CreateRecordset ?u?~ '80004005' £gLak?u¢DXao?u?~ /search/query.asp, |C203
14
10142
by: Abhi | last post by:
FYI: This message is for the benefit of MS Access Community. I found that this prblem has been encounterd by many but there is hardly any place where a complete solution is posted. So I thought I should give back to the community by posting our findings. Thanks you all for all your help till now by posting problems and their solutions. ~Abhijit
4
2963
by: MLH | last post by:
< < < VERY LOW PRIORITY POST > > > When I'm creating a query in the QBE grid whose SQL looks like this... INSERT INTO tblOwners (OwnerFName, OwnerLName, OwnerAddr, OwnerCity, OwnerState, OwnerZip, OwnerPhone, OwnerSSN, UserID) SELECT !! AS OwnerFName, !! AS OwnerLName, !! AS OwnerAddr, !! AS OwnerCity, !! AS OwnerState,
18
7334
by: William | last post by:
I have the following javascript function that updates a scroll_list and sends the updated entry (with its index) to a server script ( i.e. http://mkmxg00/cgi/confirmUpload.pl ) for further processing: function saveText( scroll_list, t_area, listToBeUpdated ) { scroll_list.options.text = t_area.text; scroll_list.options.value= t_area.value; var req; var url = "http://mkmxg00/cgi/confirmUpload.pl";
9
9694
by: Ecohouse | last post by:
I have a main form with two subforms. The first subform has the child link to the main form identity key. subform1 - Master Field: SK Child Field: TrainingMasterSK The second subform has a master-child link to the first subform. subform2 - Master Field: subTrainingModule.Form!TrainingModuleTopicSK Child Field: TrainingModuleTopicSK
8
1951
by: nishkrish | last post by:
Hi, I am new to access I created the form and report from Allen Browne's Frmwhat Date the way he has described but when i preview report it shows StartDate: name? Enddate: name? am i suppose to attach this form or report to some table or query if so how
15
3251
by: Lawrence Krubner | last post by:
Does anything about this script look expensive, in terms of resources or execution time? This script dies after processing about 20 or 25 numbers, yet it leaves no errors in the error logs. This is on a server that handles a fairly demanding site. The defaults, in php.ini, have all been cranked fairly high: scripts get 180 seconds to run, and they can have as much as 256 megs of RAM. The input for this script is coming from a textarea in...
0
8788
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 synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9335
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 captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9208
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8210
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6751
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 instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6053
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 into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4570
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4825
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2745
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.