Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Can I use vb to open a form then select a value in a combobox please?

Status
Not open for further replies.

steveroot

IS-IT--Management
Dec 29, 2000
20
GB
Hi all,

I am writing a new invoice database for my small business. Customers are held in a seperate table to the invoices. When a new customer is added, i want a button to close the 'addcustomer' form, open the 'invoice' form (that bits been easy) but then..
***
Select the customer that has just been added from a combo box on the invoice form.
***
The combobox is bound to the customerID, and i have the new customers id held in visual basic code from before i closed the 'addcustomer' form. I also want the same thing to happen when we want to invoice an existing customer, ie have a form to lookup customers, select the one we want, then open a new invoice with that customer automatically selected.

If anyone can help it would be greatly appreciated.
Regards,
Steve Root
 
I have found that the easiest way to do what you want is the use of Global Variables. You Make a new Module and in the General Section of the Module declare your variable and type

i.e.

Public CustId as long
Public Custname as string

Then you simply have to set the variable in one form or module and then just use it like you would any other variable.

Walt III
SAElukewl@netscape.net
 
Thanks Walt, but i dont quite understand.

I still dont know how to select the customer from the combobox. Because I probably didnt explain it very well, i've uploaded the database to my website (msaccess 95) as I'm sure seeing the problem first hand will make it easier for me to be understood.

or
(MS Access 95 - 270Kb)
or
(zipped version of above - 52Kb)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top