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

Billing and Shipping forms

Status
Not open for further replies.

kchampio

Programmer
Aug 7, 2006
3
US
I need help here is what i want to do. I have a billing table with all the standard billing info and at the bottom i have a check box saying 'is this the same address used for shipping' then i have 2 check boxes one 'yes' and one 'no' if i check yes then i want it to do nothing except for store the info. If i check no then i want it to show the shipping info boxes which i can type in and also store the info. I know this is very possible to do but dont know how please anyone help me. Thanks
 
Sure is!
You will need a form and some vb.

The fastest way to make your form is to open the table for which you want to make a form. On your toolbar area, there is a button that looks like a form with a lightning bolt - this button creates an autoform with all of your fields in your table. Save the form, and close the table. View the form in design view (right click, Design...)

Select the Field controls you want hidden unless the user checks No. Right click the controls and select properties. Set the Visible property to No.

Add an option group to your form, and name it optShowHideControls. Add the following code to optShowHideControls_AfterUpdate event by right clicking the option group and selecting Properties>Events>AfterUpdate.
Code:
Sub optShowHideControls_AfterUpdate()
On Error GoTo Err_optShowHideControls_AfterUpdate

If Me.optShowHideControls.Value = 2 Then 'user chose No
     Me.[!]YourBillingField1[/!].Visible = True
     Me.[!]YourBillingField2[/!].Visible = True
     'Etc
Else
     Me.[!]YourBillingField1[/!].Visible = False
     Me.[!]YourBillingField2[/!].Visible = False
     'Etc
End If

Exit_optShowHideControls_AfterUpdate:
     Exit Sub

Err_optShowHideControls_AfterUpdate:
     MsgBox Err.Description
     Resume Exit_optShowHideControls_AfterUpdate
End Sub

You will need to change the items in red to match the actual fields/ctonrols you have in your db.

Incidentally, I'm not sure an option group is your best choice, but let's play with this for a start.

Tom

Born once die twice; born twice die once.
 
i have two created 2 tables one billing and one shipping are those what i am supposed to but in there?
 
You want a form/subform. Make sure your tables are related by an ID field, such as CustomerID. If you link your tables, then open your main table as if your were going to enter data, then click the autoform button, you will get a form with a subdata sheet in which you can enter shipping addresses. You could then use the above code, but you will set the visible property of your billing table in your form to False, and then refer to the embedded table in the code, like this:
Code:
Me.ChildTableName.Visible = True

Hope this helps.

Born once die twice; born twice die once.
 
Actually i figured it out with the first way you said, worked just like i wanted it to, thanks alot
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top