Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / New Users / February 2006

Tip: Looking for answers? Try searching our database.

Default Values on Form Combo based on Fields in Customer Table

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
scs - 19 Feb 2006 06:15 GMT
Here's one I could use some assistance with:

I have a payment table and a payment form.  When my customer is paying for a
membership I enter a date and then tab to a combo to grab the customer
(cboCustomer), then I tab to another combo and choose the membership type
(cboMembershipType) then I tab and type the dollar amount into the Amount
control.

My question is:  If I were to setup a couple of fields in the Customer table
(tblCustomer) called DefaultMembershipType and DefaultMembershipAmount,
would it be possible to set the default property of the cboMembershipType
and the Amount controll to equal the fields in the customer table and fill
accordingly?  If so could someone please tell me how or point me to info.
Thanks very, very much.  This forum is wonderful.  My wife is starting to
think I'm a programmer or something.  ha ha :)
tina - 19 Feb 2006 09:05 GMT
yes, it's possible. since you're using a combo box control to choose the
customer (cboCustomer), it's actually pretty easy. add the two new fields to
your table. in the form design view, go to the combo box and change the
RowSource property to include those two fields. make sure you change the
ColumnCount property to include the additional fields. suggest you also set
the length of the two fields to zero (0") in the ColumnWidth property. the
result is that you've added two columns to the combo box, which hold the
default values for each member, so the values are available for use
elsewhere in the form; and you've hidden the additional columns so they
won't be seen in the combo box's "droplist".

in the combo box control's AfterUpdate event procedure, add the following
code to set the value of the cboMembershipType and Amount controls, as

   Me!cboMembershipType = Me!cboCustomer.Column(n)
   Me!Amount = Me!cboCustomer.Column(n)

you'll have to replace the "n" with the correct column index number for each
value. the columns in combo box controls are zero-based, so the first column
(counting from left to right) is 0, the second column is 1, the third column
is 2, etc.

hth

> Here's one I could use some assistance with:
>
[quoted text clipped - 11 lines]
> Thanks very, very much.  This forum is wonderful.  My wife is starting to
> think I'm a programmer or something.  ha ha :)
scs - 19 Feb 2006 20:12 GMT
Very cool!  Thanks that worked great and will be very handy for other things
too.

> yes, it's possible. since you're using a combo box control to choose the
> customer (cboCustomer), it's actually pretty easy. add the two new fields
[quoted text clipped - 44 lines]
>> Thanks very, very much.  This forum is wonderful.  My wife is starting to
>> think I'm a programmer or something.  ha ha :)
tina - 19 Feb 2006 20:17 GMT
you're welcome; yes, it's a handy little trick.  :)

> Very cool!  Thanks that worked great and will be very handy for other things
> too.
[quoted text clipped - 47 lines]
> >> Thanks very, very much.  This forum is wonderful.  My wife is starting to
> >> think I'm a programmer or something.  ha ha :)
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.