Solved

easy questions about access forms

Posted on 2006-10-31
9
154 Views
Last Modified: 2010-05-18
Hi to everyone!

Here are some easy points for whoever answers me those 2 easy questions:

1.) I have set up a form and I have a column in my database which is called "Searchword" (let's say it's column #3). I would like to have a field in my form in which I would type the searchword and the other fields of the form would show me the whole information in the respective entry which I could later edit. How can I achieve that?

2.) I also have a field in this form (and a column in my database) where I manually typed the date of the last change in this entry. I would really like this to happen automatically, that is, I would enter a change in any field of my form and the date of change (shown both in the database and the form) should be set automatically to the current date.

Thank you all in advance!

P.S.: Or should I have probably posted my question in the MS Office category?
0
Comment
Question by:luchko
9 Comments
 
LVL 15

Assisted Solution

by:cquinn
cquinn earned 250 total points
ID: 17841587
You should post a link to this in the Access forum - but while it's here:


2.  In the BeforeUpdate event on the form add something like this (assuming the date box on the screen is called txtDateUpdated)

Me.txtDateUpdated = Date()
0
 

Author Comment

by:luchko
ID: 17857848
Ok, I posted the link.

However, I tried your proposal, and it didn't work. Can it be that I somehow set some wrong properties of the date box?!
0
 
LVL 27

Accepted Solution

by:
MikeToole earned 250 total points
ID: 17858104
1) The easiest way is via an extra field on your form not bound to any data in your table, let's call it txtSearch. In the after update event of txtSearchyou put in the code to navigate to the required record. E.g
   me.recordset.findfirst "SearchWord = '" & txtSearch & "'"
2) As in cquinn's suggestion, use the BeforeUpdate evnt of the form to assign the change date. If you don't want to show the DateUpdated on the form itself you can assign the value directly to the underlying field:
   me!DateUpdate = Now()

I've used Now() rather than date to include the time of the change as well as the date
0
Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

 

Expert Comment

by:smidgen
ID: 17871917
Have you tried the Combo box Wizard to find a record on your Form?
1) Create a Combo box using the Wizard
2) Choose the third option - "Find a record on my form based on the value selected in my Combo box"
3) Coose the field, which will be "Searchword"

you then have the option of typing in the word or searching for it via the drop down list
0
 
LVL 20

Expert Comment

by:clarkscott
ID: 17873109
if isnull(me.DateUpdate) then
    me.DateUpdate = date()    ----- or Now()
end if


This will prevent this date field from being OVERWRITTEN everytime you view it.

(There are other ways to achieve this result)

Scott C
0
 

Author Comment

by:luchko
ID: 17898948
cquinn, I modified your answer a little bit and it did the job. As soon as my first question is answered, you would become half the points.
However, no one provided a satisfying answer to my first question. smidgen, yours does not work for me at all and MikeToole's also returns an error (which is quite logical). Perhaps I did not explain the situation that good, so here it is once again:
I have a form which shows the record sets and I can scroll through them. I also have a field and a "Search" button next to it. What I would like to have is, as soon as I press the "Search" button, the word in the field is being searched for in, say, the third column in my database, and, once found, the form would show me all the data in it. How do I do that?
Please ask if further explanation is needed.
0
 

Author Comment

by:luchko
ID: 17905842
Ok, MikeToole, I got it :) Say, is there any possibility that Access would search only the first letters of the searchword instead of the whole of it? Like, say, if my searchword is "appleseed", and I type "apples", then the word "appleseed" would be searched for?
0
 

Author Comment

by:luchko
ID: 17913462
OK, still no answer today, so I just split the points. I hope that at least someone would try to answer my last question. Thanks to everyone for their posts!
0
 
LVL 27

Expert Comment

by:MikeToole
ID: 17913491
Yes:

me.recordset.findfirst "SearchWord Like '" & txtSearch & "*'"

for your example this would come out as:

me.recordset.findfirst "SearchWord Like 'Apples*' "

The * at the end of the search term is a wild card character, saying that you don't care whar comes after.

If you put Like '*apples*'  it would find the first record containing the string "apples" anywhere in the SearchWord field.

The single apostrophe '  either side of the search term is needed because searchword is a text field


0

Featured Post

Backup Your Microsoft Windows Server®

Backup all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question