[RESOLVED] Access Set Record Selector
Hey there,
i have an main access form which calls a second form.
the second form record source is based on a table.
this form has record selectors in it and i want to know how is it possible to pass the table key to that form so i can set the record selector to be on that record
cheers
Re: Access Set Record Selector
When you say that your main form calls another form, do you mean its a subform or it opens a
secondary regular form?
Re: Access Set Record Selector
its open a second regualar form.
i was wondering if using a global variable in a module, settings that to the record id i want to show and then on the form load/got focus method set the selected record.
is that possible, how can you set the selected record
Re: Access Set Record Selector
open the form with a filter applied:
VB Code:
DoCmd.openForm "frm2ndForm",acNormal,,"[REF NUM] = forms!frm1stForm!txtRefNum"
Re: Access Set Record Selector
by record selector i meant be able to set the record shown in the navigation buttons
Re: Access Set Record Selector
So if you wanted to get the record id of 100 and its the 100th record also then in your second form it would
show record 100 and show it as the 100th record too? Or just show record 100 and it be the only one (filtered)?
Re: Access Set Record Selector
thats a lot of 100s and records.....
the first one,
when the button is clicked on the 1st form (id = 100) then on the second from it will set the selected record to be 100.
but im also hoping for the user to be able to use the navigation buttons to view other records...
Re: Access Set Record Selector
use the goto record method:
i put this together quickly, form2 has a combo box with numbers, i select a number and it runs the below.
seems to work as you want. just put it into the button code and replace the combo part with the name of your text box that holds the relevant ID number
VB Code:
DoCmd.OpenForm "Form1", acNormal
With Forms!Form1
DoCmd.GoToRecord acDataForm, "form1", acGoTo, Forms!form2!Combo0.Value
End With
Re: Access Set Record Selector
Br1an_g's code is what you need but I would suggest a design change. If your using a main form, with say
1000 records, and you select one record to display in another form and give the user tha ability to navigate to
any other record, then whats the point of the second form, its a duplicate of the first?
Re: Access Set Record Selector
the second form is used to show related data from a second table
i got it working using the design component when you add a command button to the form seems toi work good