Record navigation in a form fail to work

itaiv

New member
Local time
Today, 09:54
Joined
May 19, 2013
Messages
6
Hello,
I have a data base in which there is a table where each record describe properties of one fishing trip. The first column in the table is a number (unique but not autonumber format) and I already made 10,000 records with only this index number . Now me and others in my lab are entering data to this table for each of the records.
The data entry is done using form which show one record at a time (lets call it "sail_info_F").
I made another form which has only two elements:
1. text box in which I enter a number
2. button which opens the data entry form ("sail_info_F") showing the record with the same index number as the number I enter on the text box.
(the code for this button is "DoCmd.OpenForm "sail_info_F", , , "[RECORD_NUMBER]=" & Me.TEXT_BOX_NAME"

So far so good and it does open the form in the wanted record. BUT when the form opens I can't use the buttons I have placed in this forms which move between records. Those were made with the wizard, and are working OK when I open the form directly without using the second form (The one which opens "sail_info_F" on a specific record)
Can I solve it easily? I am very new to access and have trouble following complicated answers which involves a lot of programming.

Thanks,
Itai
 
Opening the secondary Form, as you have, here, is actually filtering it so that it only displays that single Record, so there are no other Records to navigate to. You can do the same thing using the OpenArgs argument of DoCmd.OpenForm; it will open to the wanted Record but still allow navigation to other Records.

Replace you current code behind the Command Button with
Code:
DoCmd.OpenForm "sail_info_F", , , , , , Me.TEXT_BOX_NAME

Then, in the sail_info_F Form, use this code:
Code:
Private Sub Form_Load()
 If Len(Nz(Me.OpenArgs, "")) > 0 Then
  [RECORD_NUMBER].SetFocus
  DoCmd.FindRecord Me.OpenArgs
 End If
End Sub
Linq ;0)>
 
Hello and thanks for your help.
I have tried to follow your instructions and what happened is that there is an error message when I press the command button. Attached is a capture of the code for the two forms with the highlight of the debuger.
Can you tell what I did wrong?
Thanks again,
Itai
 

Attachments

  • open form Q.jpg
    open form Q.jpg
    90.6 KB · Views: 131

Users who are viewing this thread

Back
Top Bottom