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 Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VBA Code for button

Status
Not open for further replies.

fatz09

MIS
May 19, 2003
30
GB
Let me explain my situation.

I enter customer #1 information in a form. I click a button to open
another form and enter more information. Next i enter customer #2
information. I click the same button to open the form to enter more info
for customer #2 but customer #1's info is stored in the locations. I cant get
customer #2 info to come up (his storage locations in the table).
The second form is only used by certain customers not all.

If you know the code or solution for my problem I will be very greatful. My
database will be complete.

Fatz09
 
Tell me your table fields, how many tables you are using and what forms use what information.

Can you copy and paste any vba code behind the forms?

David Pimental
(US, Oh)
dpimental@checkfree.com
 
Look into the help file for OpenForm method. You can specify a WHERE clause. This is probably how you'll want to go about it. Here's an example, with made up names:

Call DoCmd.OpenForm("frmWhatever", , , "CompanyID = " & Me!txtCompanyID)

With this, I'm refering to a control on the first form that holds the Primary Key that identifies which company it is. Then I use that as a criterion for selecting which company should be displayed in the second form.

Hope that helps.

Jeremy

PS: One note abgout design--it sounds like you've got two separate forms for one entity (company). Unless these controls on the second form are rarely used, you might want to think about how you can get them all on one form--maybe using a tab control, or packing things a little more tightly. Of course, it's impossible for me to know exactly what you're presenting, and your design may be fine, I just thought I'd point out that it's standard practice to try to get all the info about one entity on one form, if it's doable in a presentable form.

==
Jeremy Wallace
AlphaBet City Dataworks
Affordable Development, Professionally Done

Please post in the appropriate forum with a descriptive subject; code and SQL, if referenced; and expected results. See thread181-473997 for more pointers.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top