473,396 Members | 1,846 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,396 software developers and data experts.

Needle in a haystack

We are faced with a problem where we have a table and need to find “the last log” (From Table1.Field3):

Table1
Field1, Field2, Field3
Ref123456, usedidPC, Log1 01/01/2008: hello1 Text 1 Log2 02/01/2008: hello2 Text 2 Log3 03/01/2008: hello3 Text 3 Log4 04/01/2008: hello4 Text 4 Log5 05/01/2008: hello5 Text 5

We need to:
1) Find “Log5 05/01/2008” from Field3 (we already have an idea what the date we are searching for)
2) Then return all text after that into a table or query

Please can you help?

Thank you
Apr 11 '08 #1
3 1842
mshmyob
904 Expert 512MB
OK this can easily be done with a Query.

Assume you have a form (called frmFilter) that calls a Query by clicking on a Command Button. On this form you have a textBox called "txtDate".

In the txtDate box you will enter a date like 05/01/2008

In your query you have all the fields you want to show including Field3.
In the query create a Custom field (call it fldFilter)

In the field value line for your custom field put the following

Expand|Select|Wrap|Line Numbers
  1. fldFilter: Mid(Trim([Field3]),Len(Trim([Field3]))-9,10)
  2.  
In the criteria line of your custom field put the following

Expand|Select|Wrap|Line Numbers
  1. >=[forms]![frmFilter].[txtDate].[value]
  2.  
Click on the check box for Don't Show for your custom field.

This will have the result of your query showing only results where your Field3 has a date >= to the value you entered in your form.

cheers,

We are faced with a problem where we have a table and need to find “the last log” (From Table1.Field3):

Table1
Field1, Field2, Field3
Ref123456, usedidPC, Log1 01/01/2008: hello1 Text 1 Log2 02/01/2008: hello2 Text 2 Log3 03/01/2008: hello3 Text 3 Log4 04/01/2008: hello4 Text 4 Log5 05/01/2008: hello5 Text 5

We need to:
1) Find “Log5 05/01/2008” from Field3 (we already have an idea what the date we are searching for)
2) Then return all text after that into a table or query

Please can you help?

Thank you
Apr 11 '08 #2
mshmyob
904 Expert 512MB
Actually I noticed a slight problem with the code. Let me make a change and repost.

cheers,
Apr 11 '08 #3
mshmyob
904 Expert 512MB
OK here is the revised. I changed the property of the textbox on the form to Short Date. Added the DateValue function to the query.

Assume you have a form (called frmFilter) that calls a Query by clicking on a Command Button. On this form you have a textBox called "txtDate". Set the format as Short Date.

In the txtDate box you will enter a date like 05/01/2008

In your query you have all the fields you want to show including Field3.
In the query create a Custom field (call it fldFilter)

In the field value line for your custom field put the following


Expand|Select|Wrap|Line Numbers
  1. fldFilter: DateValue(Mid(Trim([Field3]),Len(Trim([Field3]))-9,10))
  2.  

In the criteria line of your custom field put the following


Expand|Select|Wrap|Line Numbers
  1. >=[forms]![frmFilter].[txtDate].[value]
  2.  
Click on the check box for Don't Show for your custom field.

This will have the result of your query showing only results where your Field3 has a date >= to the value you entered in your form.

Let me know if this helps.

cheers,
Apr 11 '08 #4

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

Similar topics

1
by: lawrence | last post by:
what is the right modifier to get $string treated as one line in regex? $string = <<<EOD <?php function smoothTalker() { // code here }
5
by: Philippe Rousselot | last post by:
Hi, How do I find the second iteration of a character in a string using python this gives me the first one f1 = string.find(line,sub) this the last one f2 = string.rfind(line,sub)
27
by: Andreas Klimas | last post by:
Hello, does anybody know about a standardfunction or a simpler way to get this result. int ends_with(char *string, char *has); answer whether string ends with substring has or not.
19
by: virtualadepts | last post by:
This contest is open to everyone who knows C++. To enter all you need to do is take the Boyer-Moore String Search Algorithm, as it is written in C, and make the fastest running C++ program you can...
56
by: tasteless | last post by:
Hi guys, I need really hard questions (about 10) about PHP programming (some of elements OOP as well, but no MySQL questions - this is different part), this questions needs to be very hard, but...
2
by: jerrygarciuh | last post by:
Hello, I am converting a large scale app from Perl TemplateToolkit and Class::DBI to PHP. TemplateToolkit has elegant ways of coping with variables that may be a scalar or may be an array. ...
5
by: meendar | last post by:
Hi, I just want to parse a character string as below Char * c=abcsyd"loddggg"kjskjdfsdf; I need to stripe out loddgg from c (inside ""). How can i do this in c?
3
by: 123peter | last post by:
what is meant by haystack in vb? is it a function or what?
83
by: liketofindoutwhy | last post by:
I am learning more and more Prototype and Script.aculo.us and got the Bungee book... and wonder if I should get some books on jQuery (jQuery in Action, and Learning jQuery) and start learning about...
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: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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...
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...
0
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...

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.