Connecting Tech Pros Worldwide Forums | Help | Site Map

Access VB help

gjoneshtfc@volcanomail.com
Guest
 
Posts: n/a
#1: Nov 13 '05
Hello

I have never used VB before but have been asked to look at coding a
button in Microsoft Access. The button currently exits a form and opens
a new form and works great. However, when the new form opens i want it
to open with information about the record i had open in the previous
form.

For example: I am looking at a record for everything to do with invoice
number 50 in the first form. The second form is the invoice print
layout that i open if i need to print the invoice information alone.
When i click on the button in the first form i need to have invoice
number 50 open in the second form.

Ideally i need to store the record number and then have it open in the
next form - if this is possible??!! Alternatively i could store the
stock number or invoice number and then have the button find the record
in the next form. I have tried a few things but they all give errors or
fail to work!

Any help will be greatly appreciated.

Regards, Gareth Jones


Tom van Stiphout
Guest
 
Posts: n/a
#2: Nov 13 '05

re: Access VB help


On 27 Oct 2005 04:05:50 -0700, gjoneshtfc@volcanomail.com wrote:

The form is opened using DoCmd.OpenForm. This takes an optional
argument named WhereClause. Use it to restrict the form to only those
records where InvoiceNumber=50.

You can see an example of this in the Northwind sample application,
Suppliers form, Review Products button.

-Tom.



[color=blue]
>Hello
>
>I have never used VB before but have been asked to look at coding a
>button in Microsoft Access. The button currently exits a form and opens
>a new form and works great. However, when the new form opens i want it
>to open with information about the record i had open in the previous
>form.
>
>For example: I am looking at a record for everything to do with invoice
>number 50 in the first form. The second form is the invoice print
>layout that i open if i need to print the invoice information alone.
>When i click on the button in the first form i need to have invoice
>number 50 open in the second form.
>
>Ideally i need to store the record number and then have it open in the
>next form - if this is possible??!! Alternatively i could store the
>stock number or invoice number and then have the button find the record
>in the next form. I have tried a few things but they all give errors or
>fail to work!
>
>Any help will be greatly appreciated.
>
>Regards, Gareth Jones[/color]

gjoneshtfc@volcanomail.com
Guest
 
Posts: n/a
#3: Nov 13 '05

re: Access VB help


Hey Tom

Thanks for the reply. The WhereClause is great however the InvoiceNo is
not constant so how would i enter the clause so that it takes the
record number of the form and uses that to display only that record in
the second form?

Thanks again, Gareth

gjoneshtfc@volcanomail.com
Guest
 
Posts: n/a
#4: Nov 13 '05

re: Access VB help


Hello

I have sorted the problem out using a button to open up the form as she
wanted. It was very simple in the end! In the button wizard there is
the option to open a form and find specific data - which is exactly
what i wanted!

Thanks for your help on the matter though, without it i wouldn't have
found this option!

Regards, Gareth

Closed Thread