Closed Thread
Page 1 of 2 1 2 LastLast
Results 1 to 10 of 12

Thread: Disabling a field after the Find command

  1. #1
    Barn Newbie kl99ny is an unknown quantity at this point kl99ny's Avatar
    Join Date
    Sep 2008
    Posts
    20
    Rep Power
    2

    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. #2
    The Barnfather jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead's Avatar
    Join Date
    Mar 2008
    Location
    Washington, D.C.
    Posts
    2,347
    Blog Entries
    9
    Rep Power
    19

    I would guess after this line is where you would place that:

    Code:
    DoCmd.DoMenuItem acFormBar, acEditMenu, 10, , acMenuVer70
    
    jmurrayhead
    If you agree, give me rep. If my post helped you, click "Thanks".
    If you like it here...throw us a few bones to help support us.


  3. #3
    Barn Newbie kl99ny is an unknown quantity at this point kl99ny's Avatar
    Join Date
    Sep 2008
    Posts
    20
    Rep Power
    2

    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. #4
    The Barnfather jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead's Avatar
    Join Date
    Mar 2008
    Location
    Washington, D.C.
    Posts
    2,347
    Blog Entries
    9
    Rep Power
    19

    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?
    jmurrayhead
    If you agree, give me rep. If my post helped you, click "Thanks".
    If you like it here...throw us a few bones to help support us.


  5. #5
    Barn Newbie kl99ny is an unknown quantity at this point kl99ny's Avatar
    Join Date
    Sep 2008
    Posts
    20
    Rep Power
    2

    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. #6
    Lightning Master AOG123 is a jewel in the rough AOG123 is a jewel in the rough AOG123 is a jewel in the rough AOG123 is a jewel in the rough AOG123's Avatar
    Join Date
    Mar 2008
    Location
    Fortress Of Solitude
    Posts
    221
    Rep Power
    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
    
    As a search combo is unbound, you will not risk editing the record.
    If i helped you, make me famous by clicking the

  7. #7
    Moderator sbenj69 is a jewel in the rough sbenj69 is a jewel in the rough sbenj69 is a jewel in the rough sbenj69 is a jewel in the rough sbenj69's Avatar
    Join Date
    Mar 2008
    Location
    The frigid northern plains
    Posts
    264
    Rep Power
    6

    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. #8
    Barn Newbie kl99ny is an unknown quantity at this point kl99ny's Avatar
    Join Date
    Sep 2008
    Posts
    20
    Rep Power
    2

    Is there a code to say "after you click cancel on the find/replace, to enabled=false on meeting field"?

  9. #9
    Lightning Master AOG123 is a jewel in the rough AOG123 is a jewel in the rough AOG123 is a jewel in the rough AOG123 is a jewel in the rough AOG123's Avatar
    Join Date
    Mar 2008
    Location
    Fortress Of Solitude
    Posts
    221
    Rep Power
    6

    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
    If i helped you, make me famous by clicking the

  10. #10
    Barn Newbie kl99ny is an unknown quantity at this point kl99ny's Avatar
    Join Date
    Sep 2008
    Posts
    20
    Rep Power
    2

    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
Page 1 of 2 1 2 LastLast

Similar Threads

  1. Disabling Mouse Scroll
    By AOG123 in forum Access Database Samples
    Replies: 23
    Last Post: June 16th, 2010, 04:31 PM
  2. Field that is a link (rs) and/or text field question
    By Rebelle in forum ASP Development
    Replies: 14
    Last Post: August 12th, 2008, 08:43 AM
  3. Basic SQL command inteface
    By dr_rock in forum ASP Code Samples
    Replies: 4
    Last Post: June 17th, 2008, 01:02 AM
  4. Command Buttons Coloring
    By alansidman in forum Microsoft Access
    Replies: 5
    Last Post: May 15th, 2008, 03:57 PM
  5. Wizard1 error The command 'MoveComplete' is not valid
    By peebman2000 in forum .Net Development
    Replies: 10
    Last Post: April 28th, 2008, 02:52 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

SEO by vBSEO