Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Microsoft Office > Access and Access VBA > Access VBA
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
Access VBA Discuss using VBA for Access programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access VBA section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old September 16th, 2018, 06:24 PM
Authorized User
Points: 70, Level: 1
Points: 70, Level: 1 Points: 70, Level: 1 Points: 70, Level: 1
Activity: 100%
Activity: 100% Activity: 100% Activity: 100%
 
Join Date: Nov 2011
Posts: 15
Thanks: 4
Thanked 0 Times in 0 Posts
Question Search Results In A Blank Form, Except The Header

Access 2016

Consists of a single form using a single search. This is done with a text box and a button. The goal is to have a message box popup and let the user know there were no search results and return the user back to the text box for another search entry.

My code is below:


Code:
Option Compare Database
Option Explicit

Private Sub btnSearch_Click()
Dim SQL As String

' ADJUST FOR NO ENTRY IN THE SEARCH FIELD

If IsNull(Me.txtKeywords.Value) Then
MsgBox "Enter Address Information"
     Me.txtKeywords.SetFocus
     GoTo RePost
Else
If Len(Me.txtKeywords.Value & vbNullString) = 0 Then
MsgBox "Enter Address Information"
     Me.txtKeywords.SetFocus
     GoTo RePost
End If
End If


SQL = "SELECT [Address].[StreetAddress], [Address].[City], [Team].[TeamName], [Team].[TeamOfficePhoneNumber], [Team].[TeamEMailAddress], [TeamMember].[FirstName], [TeamMember].[MiddleName], [TeamMember].[LastName], [TeamMember].[OfficePhoneNumber], [TeamMember].[MobilePhoneNumber], [TeamMember].[MobilePhoneCarrierId] FROM (Team INNER JOIN (TeamMember INNER JOIN TeamToTeamMemberAssociation ON [TeamMember].[TeamMemberId] =[TeamToTeamMemberAssociation].[TeamMemberId]) ON [Team].[TeamId] =[TeamToTeamMemberAssociation].[TeamId]) INNER JOIN (Address INNER JOIN TeamToAddressAssociation ON [Address].[AddressId] =[TeamToAddressAssociation].[AddressId]) ON [Team].[TeamId] =[TeamToAddressAssociation].[TeamId] WHERE [Address].[StreetAddress] LIKE '*" & Me.txtKeywords & "*' ; "

'I HAVE ALSO ATTEMPTED TO USE DCount WHICH ALSO RESULTS IN A BLANK FORM EXCEPT THE FORMS HEADER

If List28.ListCount = 0 Then
MsgBox "No Address Found"
Else
    
End If

Me.Form.RecordSource = SQL
Me.List28.RowSource = SQL
Me.List28.Requery


RePost:

End Sub
I DID NOT POST THE CODE FOR THE LIST BOX. IT WORKS WITHOUT ISSUE.


BEFORE SEARCH:
http://i244.photobucket.com/albums/g...re/Capture.png


AFTER SEARCH:
http://i244.photobucket.com/albums/g...e/Capture2.png



I can't figure out why using different techniques results in that area of the form going white/blank. The message box does not display either. It is like the form wants to go in to an add record function against a read-only database.

Does anyone know how to resolve this issue?
Reply With Quote
Reply


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

BB code is On
Smilies are On
[IMG] code is Off
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 display search results... aspiretech9 PHP How-To 1 April 26th, 2005 10:12 AM
How do I display search results... aspiretech9 PHP Databases 1 April 25th, 2005 12:11 PM
Sending Search results to a Form gpboy Access VBA 5 August 6th, 2004 05:01 PM
Customize Search Results bmains ASP.NET 1.0 and 1.1 Professional 4 January 15th, 2004 07:51 AM
search with http header harpua Classic ASP Basics 3 September 9th, 2003 09:24 AM



All times are GMT -4. The time now is 06:32 PM.


Powered by vBulletin®
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.