Microsoft Access - Recalling data on a form for editing

Asked By Bob on 16-May-12 04:03 PM
Earn up to 20 extra points for answering this tough question.
When a blank form opens (automatically) for entry of the next record, I want the user to have the option of calling up another record, in case it needs to be edited. The "search" and "go to" buttons do nothing: the data flashes in the fields, and then instantly disappears. I really cannot believe that Access provides no simple way of searching for a record and showing it in the proper form. So I assume I'm missing something very basic. What is it? Thanks, Bob
Bob replied to Somesh Yadav on 17-May-12 12:32 PM
I'm sorry, but I cannot accept your answer. The people at Microsoft are not fools. There has to be a simple answer to my problem. The "go to" and search" buttons are not working, which suggests that I have done something wrong with the controls, perhaps. It should not requre programming to make them function. Nor should it be necessary to add code to make the data appear in the fields. Where is Pat Hartman?

Bob
wally eye replied to Bob on 17-May-12 10:37 PM
Have you tried puttting a button on the form, and tying it to a macro that toggles DataEntry mode:

Private Sub btnToggleDataEntry_Click()

    Me.DataEntry = Not Me.DataEntry

End Sub


Once you take dataentry mode off, you should be able to filter or change the recordset as needed to find the desired record.
kalpana aparnathi replied to Bob on 20-May-12 06:50 AM
hi,

Try below example Code:

Dim intResponse
intResponse = MsgBox("Login another sample with same data? Clicking No will create a new blank record, click Cancel to quit login.", vbYesNoCancel)
If intResponse = vbYes Then
   'code here to continue login of new record with same data as previous record
   
ElseIf intResponse = vbNo Then
   'code here to continue login with blank record
Else
   'code to quit login such as DoCmd.Close acForm, Me.Name, acSaveNo
End If


Regards,
Pat Hartman replied to Bob on 20-May-12 04:29 PM
When you open a form in DataEntry mode, the recordsource is limited to only those records you have entered since the form opened.  Once you close the form and reopen it, the recordsource is empty again.  That's why the search won't work.

If you want to use a form for both edit and add, it is better to not use DataEntry mode.  Instead, open the form normally.  Let the user use the search features to find a particular record or use the * on the scroll bar to go to a new record.  If you prefer, you can add a New Record button.
Bob replied to Pat Hartman on 20-May-12 05:38 PM
Thanks, Pat. As usual, your answer responds directly to the question, and helps me (us) understand better how Access works as a program and product.