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!

Auto Populate Field in Table

Status
Not open for further replies.

DiTab1

Technical User
Feb 9, 2005
5
US
Hi everyone, hope someone can help me...

I have the following:

Main Table (MainID) Lists all my companies.
Benefit Table (BenID) contains a benefit summary for each company.
BeneDesc Table (BDID) Contains a list of all possible benefits.

Here is my scenerio:

I want to be able to elect to have my Benefit Table autopopulate with ALL Benefits listed in the BeneDesc Table. The fields in my Benefit Table are:

BenID (Pri Key)
Description (Number - Lookup Field which points to the BeneDesc Table)
Start Date
End Date

If the user decides that a company should have benefits then they will get ALL benefits, therefore, I would like to be able to populate them w/out having to manually select them line by line.

Any help would be appreciated!
Thanks!
~Di
 
If we assume that the user clicks a button to add the benefits, the buttons Click event could run an Append query. It might look like:
Code:
Dim db as Database
Dim sSQL$

    sSQL = "INSERT INTO [Benefit Table] ( MainID, Description) " & _
           "SELECT " & Me!MainID & ", Description " & _
           "FROM BeneDesc"
    Set db = currentDb
    db.execute sSQL 
    Set db = nothing
I'm guessing that the Start and End dates are specific to your [Benefit Table], and not obtained from BeneDesc.



Max Hugen
Australia
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top