home hardware prices news articles forums photos user reviews
Go Back   Tech Support Forums - TechIMO.com > PC Hardware and Tech > Webmastering and Programming
Join TechIMO for Free!
Register Blogs FAQ Members List Calendar Search Today's Posts Mark Forums Read
Reply Get bargains at  »  Dealighted.com
 
Thread Tools
Currently Active Users: 1769
Discussions: 188,401, Posts: 2,243,603, Members: 232,630
Old July 31st, 2004, 07:39 AM   Digg it!   #1 (permalink)
Junior Member
 
Join Date: Jul 2004
Posts: 11
Exclamation
MS Access Database

Hi there;

Hope someone can help here, and the solution not bee to complicated.


What i want to do is create an error message for a filter, if it doesn't return any entries, rather than showing a blank version of the form.

This is annoying and doesn't explain why the form is blank to whoever is using it.

Is there anything i can do???

Thanks.

Dan

danlindley is offline   Reply With Quote
Old August 1st, 2004, 05:48 AM     #2 (permalink)
Member
 
Join Date: Sep 2002
Posts: 364
Yes. How are you setting the filter? In code?

Creosote is offline   Reply With Quote
Old August 1st, 2004, 07:47 AM     #3 (permalink)
Junior Member
 
Join Date: Jul 2004
Posts: 11
No, not using code, i am using Access to filter it itself.

I'll explain, i have a form, that is a search box, when you click on "Search" access does the "open form and find specific data to display" and then brings up another form with the results in it.

When the form matches nothing, the form that comes up is blank with only the background colour visable. No buttons, no fields, nothing.

I just want either that box to display "your results turned up nothing," or an error message from a macro to say the same and close the form.

Something like that.

I'd appreciate any help, but i don't do Vis basic code.

Thanks

Dan

danlindley is offline   Reply With Quote
Old August 1st, 2004, 03:28 PM     #4 (permalink)
Member
 
Join Date: Sep 2002
Posts: 364
I am unfamiliar with what exactly you are doing. Did you create a form, then add a button, and choose one of the default Access buttons? If so, what did you pick, "Apply Filter", "Open Form", "Find a Record", or what?

What you want to accomplish is fairly easy, but I need to know exactly how your form is constructed now.
Creosote is offline   Reply With Quote
Old August 1st, 2004, 04:38 PM     #5 (permalink)
Junior Member
 
Join Date: Jul 2004
Posts: 11
When i set up the search form firstly i added a button by using the tool in the toolbox, which automatically opens the button wizard.

I then set it to open a form and selected the form i wanted it to open.

It then asked me to select either;

"Open form and find specific data to display" or
"Open the form and display all records"

I selcted the first one, "find sepcific data to display,"

after that it gave me a list of available fields to match the data with; so i selcted the fields from both tables that the filter had to match.

field one.table one<->anotherfield.tabletwo (sort of thing)

and thats it...

hope it helps, and you can help me.
danlindley is offline   Reply With Quote
Old August 1st, 2004, 11:24 PM     #6 (permalink)
Member
 
Join Date: Sep 2002
Posts: 364
Well, I don't have that exact button, but I worked out what you are doing. Regardless, you will need to go into the VBA code of your 2nd form. Press Alt-F11 while in design mode. Paste in this code:

Code:
Private Sub Form_Load()
    If Me.Recordset.BOF And Me.Recordset.EOF Then
        MsgBox "There are no records to display."
    End If
End Sub
Creosote is offline   Reply With Quote
Old August 2nd, 2004, 02:22 PM     #7 (permalink)
Junior Member
 
Join Date: Jul 2004
Posts: 11
That has helped, but i have a further question,

as well as that code opening a msg box, can i make it close that form and go back to the form before it, or run a macro that willo do that?

thanks again;

Dan
danlindley is offline   Reply With Quote
Old August 2nd, 2004, 10:09 PM     #8 (permalink)
Member
 
Join Date: Sep 2002
Posts: 364
Add a DoCmd.Close in there after that Msgbox statement.
Creosote is offline   Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I send a MS Access Report or data over the LAN to another computer? scout78 Networking and Internet 15 April 19th, 2004 09:07 AM
MySql forum database?? jch216 Webmastering and Programming 1 May 8th, 2003 11:37 PM
Database basics PyroSama Webmastering and Programming 8 January 15th, 2003 10:43 PM
Access 97 Query kickzum Applications and Operating Systems 6 August 30th, 2002 06:28 PM
More asp/sql ... Agent_Embryo Webmastering and Programming 3 February 25th, 2002 05:55 AM

Most Active Discussions
Is It Just Me? (2906)
Unarmed man on his stomach shot by .. (6)
Misery Loves Company... (2144)
New Build ( Finally ) (6)
CPU wont boot (7)
Building a gaming computer advice (5)
I think I just killed my computer w.. (24)
Folderchat Weekday thread (444)
Upgrading RAM (6)
Recent Discussions
New Build ( Finally ) (7)
Common Spyware Solutions (97)
How do you move a hard-drive to.. (4)
Laptop proccesor to desktop mob.. (1)
What is the best external enclo.. (0)
Partition Magic 7.0 (Unallocate.. (17)
For cheap price and good qualit.. (1)
Left 4 Dead Small Freezes (3)
RCA 52Inch HDTV wont turn on (4)
Blackberry Storm, Gears of War .. (1)
Core 2 Quad Q9550 system (3)
COWBOOM Ripoff! Used Laptop w/$.. (4)


All times are GMT -4. The time now is 03:45 AM.
TechIMO Copyright 2008 All Enthusiast, Inc.



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28