Results 1 to 8 of 8
  1. #1
    sambeer is offline Novice
    Windows XP Access 2007
    Join Date
    Nov 2011
    Posts
    5

    ctrl F on Form with Enabled and Disabled bound boxes

    Hello..

    I have an access form which is a survey / questionnaire.

    It uses VB code for enabling and disabling the data entry boxes.

    If you consider B16, B17 and B18 are three fields, then

    B17 and B18 are disabled in the form's property sheet.

    If B16 is 'Yes' then B17 is enabled for entering data (Yes/No).


    If B16 is 'No' or 'Null' B17 is disabled for entering data (Yes/No) and set to Null.
    If B17 is 'Yes' then B18 is enabled for entering data ( A Date like 12/11/2011 ), else B18 is disabled and set to Null.

    Say I marked B16 = Yes, B17=Yes and entered B18=12/1/2011.

    I put the cursor in a 'Study ID' field and do a Ctrl+F, where I enter the 'Study ID' for the record to show up on the form. Everything's fine and this works. The problem is when someone closes the access database and reopens it, and then tries to do the ctrl+F to pull a record he wants to verify/Change.

    Say, I reopen the database and want to Mark B17=No. So I do a ctrl+F to search the study ID and the record shows up on Form, it somehow doesnt recognize the record's loaded and I cant change B17 to 'No' cuz its disabled. So B17 is still marked Yes and is disabled for me to change it to 'No'. And of course, B18 has the date in there and its disabled. Note that this is happening only when using the Ctrl+F to show a record. When the form Opens and during the After Update event of the boxes everything's fine.

    Can anyone suggest something please?

    Thanks..

  2. #2
    boblarson is offline --------
    Windows 7 64bit Access 2010 32bit
    Join Date
    Jun 2011
    Posts
    1,272
    Do you have any code in the On Current event of the form to disable edits?

  3. #3
    sambeer is offline Novice
    Windows XP Access 2007
    Join Date
    Nov 2011
    Posts
    5
    Quote Originally Posted by boblarson View Post
    Do you have any code in the On Current event of the form to disable edits?
    Hi Bob,

    No code's under the On current event of the form.

    Maybe I should include the code that I use under the On Open event under the On dirty event for it to trigger the changes.. Would you think that'll work..

    Thanks..

  4. #4
    boblarson is offline --------
    Windows 7 64bit Access 2010 32bit
    Join Date
    Jun 2011
    Posts
    1,272
    Quote Originally Posted by sambeer View Post
    Hi Bob,

    No code's under the On current event of the form.

    Maybe I should include the code that I use under the On Open event under the On dirty event for it to trigger the changes.. Would you think that'll work..

    Thanks..
    No, I wouldn't do that. Personally, I woiuld probably not be using the built in Find using the Ctrl + F. I would use my own search form and then I have more control over the recordset and recordset clone which might be better.

  5. #5
    sambeer is offline Novice
    Windows XP Access 2007
    Join Date
    Nov 2011
    Posts
    5
    Quote Originally Posted by boblarson View Post
    No, I wouldn't do that. Personally, I woiuld probably not be using the built in Find using the Ctrl + F. I would use my own search form and then I have more control over the recordset and recordset clone which might be better.
    Thank you { It didnt work }, Is there an example somewhere online for me to get this done?

    Thanks..

  6. #6
    sambeer is offline Novice
    Windows XP Access 2007
    Join Date
    Nov 2011
    Posts
    5
    Also noted that the same thing's happening when I split the form with a datasheet view at the bottom. When I click on the datasheet the record loads but it has the same problem..

  7. #7
    boblarson is offline --------
    Windows 7 64bit Access 2010 32bit
    Join Date
    Jun 2011
    Posts
    1,272
    I don't have an example but here's some code you could use for the search form.

    So let's say you have the custom search form with a single text box (named txtSearch) and a button named cmdSearch. So the event on the button would be something like:

    Code:
    Dim rs As DAO.Recordset
     
    Set rs = Forms!YourFormNameHere.RecordsetClone
     
    rs.FindFirst "[Study ID]=" & Me.txtSearch
     
    If rs.NoMatch Then
       MsgBox "No match was found"
    Else
       Forms!YourFormNameHere.Bookmark = rs.Bookmark
    End If
    If Study ID is text then you would change this line:
    Code:
    rs.FindFirst "[Study ID]=" & Me.txtSearch
    to this
    Code:
    rs.FindFirst "[Study ID]=" & Chr(34) & Me.txtSearch & Chr(34)

  8. #8
    sambeer is offline Novice
    Windows XP Access 2007
    Join Date
    Nov 2011
    Posts
    5
    Hi Bob,
    Thank you so much for that code. I definitely plan to use it!

    Regarding my problem, I put the code for the On Open event under the On Current event as well, and that seems to have worked on first look. I will verify if it really works over the next couple of days and mark this thread..

    Thanks again..

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 9
    Last Post: 06-04-2014, 10:45 AM
  2. Replies: 2
    Last Post: 09-06-2011, 04:56 PM
  3. Replies: 3
    Last Post: 09-02-2011, 01:12 PM
  4. Replies: 4
    Last Post: 09-10-2009, 03:09 AM
  5. Replies: 10
    Last Post: 08-01-2009, 06:48 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums