473,385 Members | 1,782 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Search Form

f430
43
i have been trying to write a search code for a similar database, and i followed all the steps that were provided above, and my code was close to what lightning had but i have added date range in my search to search in between 2 dates, and i put this code in:

Expand|Select|Wrap|Line Numbers
  1. If Not IsNull(Me.date1) Then
  2.         strWhere = strWhere & "([Date] >= " & Format(Me.date1, conJetDate) & ") AND "
  3.     End If
  4.        If Not IsNull(Me.date2) Then
  5.         strWhere = strWhere & "([Date] < " & Format(Me.date2 + 1, conJetDate) & ") AND "
  6.     End If
do you think that code is correct??


i am also having problems with the last step, where u do "DoCmd.OpenForm "masterform", , , strFilter"
i did that but i keep getting an error message, and when i go to debug this line is always highlighted.

i have a table called master form which has all my information, i made a form that is a duplicate to my master table in order for the last step to work, but i am not sure what is wrong.

Mary, i really hope you can help me with this, since you seem to be the only active member!!

i would appreciate any help on this.
Thanks

** Edit **
This post was a hijack of Search Form: multiple controls (Access 2003). I will split it across to its own thread. Please remember in future to create a new thread for your questions.
Aug 5 '10 #1
9 1831
f430

I am using a calendar control for searching between two separte dates to find information. Is this what you are looking for?
I, for instance, am using a combo box with the event of mousedown to bring up the calendar for both the from date and the to date. Is this something you would like to see?
Aug 5 '10 #2
f430
43
i am using a text box to enter the date as in mm/dd/yy.
but i dont think my code is working out.
so i think a calendar view would work a lot better.
i would appreciate some help with this coding for this calendar view

thanks
Aug 5 '10 #3
NeoPa
32,556 Expert Mod 16PB
Hopefully, splitting this question into its own thread will give you a greater chance of getting any responses.

Good luck and welcome to Bytes!
Aug 6 '10 #4
Here is what I found and that is working for me.
This is the code for the "From" combo box, the name I used was fromdatecmb and the calendar is named ocxcalendar

Expand|Select|Wrap|Line Numbers
  1. Private Sub fromdatecmb_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
  2.  
  3.     Set Originatorcmb = fromdatecmb
  4.  
  5.     ocxcalendar.Visible = True
  6.     ocxcalendar.SetFocus
  7.     If Not IsNull(Originatorcmb) Then
  8.         ocxcalendar.Value = Originatorcmb.Value
  9.     Else
  10.         ocxcalendar.Value = Date
  11.     End If
  12. End Sub
Now here is the code I use for the todatecmb box

Expand|Select|Wrap|Line Numbers
  1. Private Sub todatecmb_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
  2.     Set Originatorcmb = todatecmb
  3.  
  4.     ocxcalendar.Visible = True
  5.     ocxcalendar.SetFocus
  6.     If Not IsNull(Originatorcmb) Then
  7.         ocxcalendar.Value = Originatorcmb.Value
  8.     Else
  9.         ocxcalendar.Value = Date
  10.     End If
  11. End Sub
Now the calendar needs to have focus:
Expand|Select|Wrap|Line Numbers
  1.  Private Sub ocxcalendar_Click()
  2.     Originatorcmb.Value = ocxcalendar.Value
  3.     Originatorcmb.SetFocus
  4.     ocxcalendar.Visible = False
  5.     Set Originatorcmb = Nothing
  6. End Sub
There is a caveate to all of this, the field from the table you are pulling your data needs to be a text field or you will get a data type mismatch error. Also, you will need to make the calendar not visable in the properties of the calendar under design.

Check out this thread of mine where I asked for help with the same question. There is some great info from Neopa.

http://bytes.com/topic/access/answer...-query-records

I hope all this helps.

MJA
Aug 6 '10 #5
NeoPa
32,556 Expert Mod 16PB
Thanks Michael. I'm glad you pointed me back there, as I found an error in my post when I looked it over again :D Sorted now.
Aug 6 '10 #6
f430
43
Thanks Michael, this calendar view solved the issues i was having with the date.
my other question is, since the "from" and "to" dates are a combo box, can i just treat it as any combo box code for my search. because my search form contains 3 combo boxes and the date (2 additional combo boxes).
in other words can i just use this type of a code:

Expand|Select|Wrap|Line Numbers
  1. Dim strFilter As String
  2. Dim varItem As Variant
  3.  
  4. strFilter = ""
  5. strQt = Chr$(34)
  6.  
  7. If Not IsNull(Me!ProductName) Then strFilter = strFilter & "[Product ID]=" & strQt & "*" & Me!ProductName & "*" & strQt
however, im not exactly sure how to make it search in between these two dates?
Aug 6 '10 #7
Where are you putting your from and to values in your if not isnull statement?

I was doing a cdount for my search and this is what it looked like:
Expand|Select|Wrap|Line Numbers
  1. EADRcount = DCount("[type]", "WorkOrderTracking", "[workedby] = 'MJA' And [cudate] between '" & Me.fromdatecmb.Value & "' and '" & Me.todatecmb.Value & "'")
This code gave me a total count of all records for that date range.
[Type] = text field in the table
"WorkorderTracking" = the table
[workedby]='MJA' = search criteria limited to the employee matching MJA
between = operator used for the date range
"& me.fromdatecmb.value &" = the from value selected on the calendar
and = operator used for date range from 'and' to
"& me.todatecmb.value &" = the to value selected on the calendar

I hope this also helps.
Aug 6 '10 #8
f430
43
i was trying to get my search to filter a master table, which contains all the information such as date, part number,...and i am trying to make this date range one of the ways i could search through my master sheet.
Aug 6 '10 #9
f430
43
i am not really very familiar with this coding language, so i am not really sure how to make a code for a combo box for my search
Aug 6 '10 #10

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

Similar topics

2
by: misschristalee | last post by:
I'm having a brain blockage day.... Scenario: Search Form with 6 text boxes Query has same six fields Each has this IIF: IIf(IsNull(!!),"",!!) with each dictating the correct text box of...
3
by: Liddle Feesh | last post by:
Hi, I have a table named "Person" in a MSDE (2000) database, and am building a search form comprising of search fields on the top section (forename, surname, telephonenumber, etc) which all...
7
by: jim Bob | last post by:
Hi, This is probably very simple to do so if anyone can point me to the right place for reading, it would be much appreciated. I just want to build a very basic search form where i can enter a...
1
by: Eddie Holder | last post by:
Hi Guys, I hope that someone will be able to help I have a table containing data, lets say products. I have a form with a text box which serves as the criteria for a query to search the product...
31
by: DWolff | last post by:
I'm somewhat new to Access, and have no VB experience at all (except for modifying existing code where obvious). I built a data entry form that works fine. Typically, a client will call in and...
9
by: lightning | last post by:
Hi all, I'm not very conversant with the vocabulary of Access, so please ask for clarification if necessary... I am trying to build a search form that allows combinations of search terms. For...
6
by: KiwiGenie | last post by:
Hi..I am trying to make a search form. I am fairly new to access and could well be looking at it completely wrong. I have an unbound form with textboxes in the header for entering different search...
1
by: tamoochin | last post by:
I have a form that registers the user with my website, the form is in farsi language and must use utf-8 standard. I can store data in MS Access and also read it back with any problems. the...
2
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...
8
by: munkee | last post by:
Hi everyone, I am using the following code adapted from Allen Browne: 'Purpose: This module illustrates how to create a search form, _ where the user can enter as many or few...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
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...

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.