Re: copy value of field to find a record in another form

Tech-Archive recommends: Fix windows errors by optimizing your registry

From: Caroline (Caroline_at_discussions.microsoft.com)
Date: 02/24/05


Date: Wed, 23 Feb 2005 19:09:02 -0800

Thanks, the logic makes sense but I don't completely understand the process -
I'm a complete VB novice.
What I'm trying is to create a command button and used the build button -
code builder. This is what I've got:

Private Sub Command33_Click()
   DoCmd.OpenForm "address_book", , , Me.txtreference
   
End Sub
Private Sub Form_Open(Cancel As Integer)

End Sub

(I've renamed my ref # field as 'reference' as I was concerned about spaces
& symbols)
This is obviously incomplete because I get an error message saying compile
error: method or data member not found.
I looked up the help on OpenArgs - but wasn't really sure where it was to go
or how to use it to find the exact record.
You've probably worked out that I've got very little idea about this, so
would appreciate an access for dummies type answer.

thanks again

"George Nicholson" wrote:

> I think you are looking for the OpenForm method.
>
> with SearchResultsForm.CmdButton_Click, if RefNum is a text field in
> AddressBook:
> DoCmd.OpenForm "AddressBook", , , Me.txtRefNum
> The last argument of the OpenForm method is the OpenArgs argument. It is
> passed to the form you are opening.
> You can then place code in the Open event of the AddressBook form that takes
> that value and either goes to that record or filters on that value. See the
> Help file entry for OpenArgs for examples.
>
> --
> George Nicholson
>
> Remove 'Junk' from return address.
>
>
> "Caroline" <Caroline@discussions.microsoft.com> wrote in message
> news:F8700D9B-AC35-4526-AE64-F822AE5486F2@microsoft.com...
> > I'm a relatively new user of Access 2003 and haven't been able to find a
> > solution to this problem.
> > My database consists of one table (addresses) that contains numerous
> > contact
> > and personal details for clients. I have developed a parameter query
> > (search_query) loaded through a form (search_form) that enables users to
> > identify records based on name and/or organisation etc. The results of the
> > query are then displayed on a new form (search_results_form).
> > What I want to do is add a command button on this form that will allow the
> > person to go to the complete address record in the address_book form. The
> > process that I've been thinking through is:
> > - copy the ref # of the active record in the search_results_form (a text
> > box
> > bound to the field ref # in the query)
> > - open the address book form
> > - search in the field ref # for the corresponding number
> > - at some stage close the search_results_form
> >
> > I've spent ages trying different functions and expressions but have got
> > absolutely nowhere. I'm hoping that there's some relatively simple
> > solution
> > as this is a critical part of the whole database.
> >
> > Thanks very much in anticipation of your help.
>
>
>


Quantcast