This is a discussion on Disabling a field after the Find command within the Microsoft Access forums, part of the Databases category; Hi All, Question...How do I disable a field after the Find command? Below is the code for the find command ...
| |||||||
|
#1
| |||
| |||
| Hi All, Question...How do I disable a field after the Find command? Below is the code for the find command through wizard. I guess I need to enabled=false somewhere but I don't know where to place it. Thanks! ![]() Private Sub CmdFindRecord_Click() On Error GoTo Err_CmdFindRecord_Click Screen.PreviousControl.SetFocus DoCmd.DoMenuItem acFormBar, acEditMenu, 10, , acMenuVer70 Exit_CmdFindRecord_Click: Exit Sub Err_CmdFindRecord_Click: MsgBox Err.Description Resume Exit_CmdFindRecord_Click |
|
#2
| ||||
| ||||
| I would guess after this line is where you would place that: Code: DoCmd.DoMenuItem acFormBar, acEditMenu, 10, , acMenuVer70
__________________ jmurrayhead If you agree with me... click the icon! If my post solved your problem, click the button in the lower right-hand corner of the post.If you like it here...throw us a few bones to help support us. Join our Folding team: DeveloperBarn Folding |
|
#3
| |||
| |||
| I have tried that and it only allowed me to search once in that field...not more than once. How could I ask it to disable the field after I have close the find box? |
|
#4
| ||||
| ||||
| Perhaps you could clarify better what it is you're trying to do. From what I gather, you display a form that is used for searching. Once a user searches, you disable the field. How many times should they be allowed to search? Why are they limited to that many searches? |
|
#5
| |||
| |||
| I'm sorry. I have a form that allow users to add a new record or edit an existing record. If a user comes in and adds a new record, they would click a button and certain fields will be enabled (All the fields are disabled in the form). And if the user is editing, they will click on the editing button and other fields will be enabled. After adding or updating, the records will be saved. I want to make it easier for the user to search for a record when updating. I would first have to enable the field "meeting" and then the search will work. But after searching, I want to disable the field again so they wouldn't change the meeting name by accident. I have put "me!txtmeeting.enabled=false" where you have suggested, but that only allowed me to search the field meeting once. If I click on 'Find Next' it doesn't work because the field is diabled. If I can, I would want the maximum to be 10 times and after that a message box to say something about refining your search. I hope I'm making sense. |
|
#6
| ||||
| ||||
| as a sugestion, you could create a combo box. Using the wizard select 'find a record on my form based on the value selected in my combo box' then select the field you wish to search. Your code will look something like, Code: ' Find the record that matches the control.
Dim rs As Object
Set rs = Me.Recordset.Clone
rs.FindFirst "[FieldName] = " & Str(Nz(Me![ComboBox], 0))
If Not rs.EOF Then Me.Bookmark = rs.Bookmark
__________________ If i helped you, make me famous by clicking the ![]() Status: Currently Unemployed - Looking for Work, Can be contacted on thethresher@hotmail.co.uk |
|
#7
| ||||
| ||||
| I'm assuming you have one button that you are doing the searching and find/next with. Put this at the top of your code: Code: If me.txtmeeting.enabled = false then me.txtmeeting.enabled = true Else me.txtmeeting.enabled = false ' 'your search function goes here ' End If |
|
#8
| |||
| |||
| Is there a code to say "after you click cancel on the find/replace, to enabled=false on meeting field"? |
|
#9
| ||||
| ||||
| Did you try using a search combo,? it won't matter if the others field are enabled or not,. Seems to make perfect sense to me unless i'm completely missing the point |
|
#10
| |||
| |||
| I have tried using a combo box and it is unbound. But for some reason, the meetings doesn't match my data...unless I'm doing something wrong. The more I play with it, the more I get . LOL. |
![]() |
|
| Bookmarks |
| Thread Tools | |
| Display Modes | |
| |
| ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Disabling Mouse Scroll | AOG123 | Access Database Samples | 22 | December 20th, 2009 07:50 PM |
| [Forms] Field that is a link (rs) and/or text field question | Rebelle | ASP Development | 14 | August 12th, 2008 08:43 AM |
| Basic SQL command inteface | dr_rock | ASP Code Samples | 4 | June 17th, 2008 01:02 AM |
| Command Buttons Coloring | alansidman | Microsoft Access | 5 | May 15th, 2008 03:57 PM |
| Wizard1 error The command 'MoveComplete' is not valid | peebman2000 | .Net Development | 10 | April 28th, 2008 02:52 PM |