DeveloperBarn Forums

DeveloperBarn

Programming & IT forum

Disabling a field after the Find command

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 ...

Go Back   DeveloperBarn Forums > Databases > Microsoft Access

  #1  
Old October 7th, 2008, 10:54 AM
Barn Newbie
 
Join Date: Sep 2008
Posts: 20
Rep Power: 2
kl99ny is an unknown quantity at this point
Default Disabling a field after the Find command

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  
Old October 7th, 2008, 11:22 AM
jmurrayhead's Avatar
The Barnfather
 
Join Date: Mar 2008
Real name: Jason
Location: Washington, D.C.
Posts: 1,964
Blog Entries: 8
Rep Power: 15
jmurrayhead has much to be proud ofjmurrayhead has much to be proud ofjmurrayhead has much to be proud ofjmurrayhead has much to be proud ofjmurrayhead has much to be proud ofjmurrayhead has much to be proud ofjmurrayhead has much to be proud ofjmurrayhead has much to be proud ofjmurrayhead has much to be proud of
Default

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  
Old October 7th, 2008, 11:27 AM
Barn Newbie
 
Join Date: Sep 2008
Posts: 20
Rep Power: 2
kl99ny is an unknown quantity at this point
Default

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  
Old October 7th, 2008, 11:32 AM
jmurrayhead's Avatar
The Barnfather
 
Join Date: Mar 2008
Real name: Jason
Location: Washington, D.C.
Posts: 1,964
Blog Entries: 8
Rep Power: 15
jmurrayhead has much to be proud ofjmurrayhead has much to be proud ofjmurrayhead has much to be proud ofjmurrayhead has much to be proud ofjmurrayhead has much to be proud ofjmurrayhead has much to be proud ofjmurrayhead has much to be proud ofjmurrayhead has much to be proud ofjmurrayhead has much to be proud of
Default

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  
Old October 7th, 2008, 11:44 AM
Barn Newbie
 
Join Date: Sep 2008
Posts: 20
Rep Power: 2
kl99ny is an unknown quantity at this point
Default

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  
Old October 7th, 2008, 11:55 AM
AOG123's Avatar
Lightning Master
 
Join Date: Mar 2008
Location: Fortress Of Solitude
Posts: 218
Rep Power: 5
AOG123 is a jewel in the roughAOG123 is a jewel in the roughAOG123 is a jewel in the roughAOG123 is a jewel in the rough
Default

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
As a search combo is unbound, you will not risk editing the record.
__________________
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  
Old October 7th, 2008, 12:02 PM
sbenj69's Avatar
Moderator
 
Join Date: Mar 2008
Location: The frigid northern plains
Posts: 260
Rep Power: 4
sbenj69 is a jewel in the roughsbenj69 is a jewel in the roughsbenj69 is a jewel in the rough
Default

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  
Old October 7th, 2008, 01:53 PM
Barn Newbie
 
Join Date: Sep 2008
Posts: 20
Rep Power: 2
kl99ny is an unknown quantity at this point
Default

Is there a code to say "after you click cancel on the find/replace, to enabled=false on meeting field"?
  #9  
Old October 7th, 2008, 02:55 PM
AOG123's Avatar
Lightning Master
 
Join Date: Mar 2008
Location: Fortress Of Solitude
Posts: 218
Rep Power: 5
AOG123 is a jewel in the roughAOG123 is a jewel in the roughAOG123 is a jewel in the roughAOG123 is a jewel in the rough
Default

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  
Old October 7th, 2008, 03:40 PM
Barn Newbie
 
Join Date: Sep 2008
Posts: 20
Rep Power: 2
kl99ny is an unknown quantity at this point
Default

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.
Closed Thread

  DeveloperBarn Forums > Databases > Microsoft Access

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads

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


All times are GMT -4. The time now is 01:50 AM.


Copyright ©2008-2010, DeveloperBarn

Content Relevant URLs by vBSEO 3.3.2