473,811 Members | 3,030 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Developing Search Function in Access

20 New Member
Hello all,

I would like to develop a date search from Form in Access. Here is the sample of previous search coding I have developed used the help of experts on this forum.

Expand|Select|Wrap|Line Numbers
  1.     'Approach to CSR
  2.     If Not IsNull(txtSearchField12) Then
  3.         GCriteria4 = GetResults(Me.txtSearchField12, "[ApproachtoCSR]", Me.optSearch)
  4.  
  5.         If GCriteria = "" Then
  6.            GCriteria = GCriteria4
  7.  
  8.         Else
  9.               GCriteria = GCriteria & " AND " & GCriteria4
  10.         End If
  11.  
  12.     End If
  13.  
  14.     'Publisher
  15.     If Not IsNull(cboSearchField2) Then
  16.         GCriteria5 = GetResults(cboSearchField2.Value, "[Publisher]", Me.optSearch)
  17.  
  18.             If GCriteria = "" Then
  19.                GCriteria = GCriteria5
  20.  
  21.            Else
  22.                 GCriteria = GCriteria & " AND " & GCriteria5
  23.            End If
  24.  
  25.     End If
  26.  
  27.     Form_frmInput.RecordSource = "select * from Entry where " & GCriteria & ";"
  28.  
  29.     Form_frmInput.Requery
  30.  
  31.     If Form_frmInput.NewRecord Then
  32.         MsgBox "No matching records found. Try less restricted search criteria", vbOKOnly, "No Matches Found"
  33.  
  34.     Else
  35.         MsgBox "Results have been filtered.", vbOKOnly, "Search Successful"
  36.         DoCmd.Close acForm, "frmSearch"
  37.     End If
  38.  
  39.  
I do want to develop something similar. From my research I gathered something like this that would go under the cmbSearch_Click function

- Date is the title of the date column and Entry is the title of the Table where the dates are stored.

Expand|Select|Wrap|Line Numbers
  1.   If Not IsNull(txtDate) AND IsDate(txtDate) Then
  2.     GCriteria6 = "SELECT Entry.* FROM Entry" _
  3.          & " WHERE Format([Date],'dd/mm/yyyy')= #" _
  4.          & Format(txtDate, "dd/mm/yyyy") & "#"
  5.  
  6.     If GCriteria = "" Then
  7.                GCriteria = GCriteria6
  8.      Else
  9.          GCriteria = GCriteria & " AND " & GCriteria6
  10.    End If
  11.  End If
  12.  
Here is my previous thread here to see how I am developing the search function

http://bytes.com/forum/showthread.php? p=3178305#post3 178305

Now the problem is to give the user a message if he enters the date is wrong format...I don't know where exactly that msg code would go or how to check if the user entered wrong date. And please do check if my code "looks right" too.

Thanks in advance for your time!
Jun 16 '08 #1
1 1633
nik707
20 New Member
figured it out using examples!
Jun 17 '08 #2

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

Similar topics

3
4210
by: Alastair | last post by:
Hello guys, I've been building a search facility for an intranet site I'm part of developing and we've been building a search engine using Index Server. It mostly works, however there have been a few niggling problems and fixing it seems to be a case of patching errors as we find them so I'm thinking that it might be worth starting the logic from scratch and rebuilding this again. Basically we have a simple search, which is simply a...
8
1420
by: Johno | last post by:
I have written the two associated base classes below (Digital_camera and Review) to manage digital camera and review objects. They are base classes for which other derived classes can be written to provide more detail. You'll notice that I've also declared the display functions as "virtual" to allow for polymorphism. I now need to write a function to display all the contents of an STL "deque" of pointers to Digital_camera objects. It needs...
6
2318
by: Jules | last post by:
Hi: I have an Access 97 Search form set up - a couple of combo boxes, a couple of text fields and a command button. I want the command button to run an SQL script and then open the results form. I can get the button to open the other form but I can't get it to run the module with the subroutine in it. This is my first sorti into programming Access so be kind - I have some SQL and ASP experience but these modules are a problem for me.
4
1572
by: DeanL | last post by:
Hi All, Having a problem developing an Access 97 database in Access 2003. The database needs to go out to a number of staff who will review it and recommend any changes but when I convert the database to access 97 format, it opens fine on my machine (with the usual convert or open message) but refuses to open on anyone elses PC with Access 97. A message pops up saying that the code needs to be recompiled for the version of VBA that is...
3
1205
by: Rachelle | last post by:
I'm developing a webpage interface for the employees I work with that will allow them to search the database for things. I have everything else set up, but i'm having problems actually developing the search script.... basically my select statement. Anyone with examples of how to do this would be appreciated. Thanks!
2
7253
by: Homey! | last post by:
Hello all I am new to Access. I have imported data from an old FoxPro 2.x database. This is probably the most basic function but I cant get a search box to work. I need to search for company name and cant figure it out in access. Tony (homey)
3
5835
by: peterhall | last post by:
In VBA an Access module has a find method - works perfectly to find a string inside a module. i'm working in A97 (legacy) systems (large ones) and want to write code that searches all modules so that I can check on the possible effects of a change. But the 97 modules collection is open modules only. Access 97 doesn't have an allmodules collection - 2000+ does - so I can move the app up for this purpose. But now I find that a module in...
4
2519
by: ravindarjobs | last post by:
hi...... i am using ms access 2003,vb6 i have a form. in that i have 2 buttons 1. start search 2 stop search when i click the "start search" button the fucntion SearchSystem() is called, it will search for a particular file in the computer(searches entire drives).
2
2270
by: Mark | last post by:
Hi All, I am creating a music database for a friend and have run into a problem. Within the ALBUM table, I wanted to store the ARTIST_ID rather than the ARTIST_NAME. To do this, I intended to have have a command button on the album form which would open a search form (based on the artist table). This works as I wanted and allows me to get to one record. I then planned to have a button on the search form which when clicked, would updated...
0
9607
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
10398
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...
1
10416
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
7676
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
6897
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
5567
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...
1
4357
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
2
3881
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3028
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 effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.