Results 1 to 2 of 2
  1. #1
    Join Date
    Jan 2004
    Location
    South Africa
    Posts
    178

    Question Unanswered: adding more fields

    hi guys and girls
    i have a certain amount of employees in a table. New employees can be added and old employees can be deleted. I want to create a label, a button and a checkbox on a form. One set for each employee. how would i go about coding this?

    thanks in advance
    actionant

  2. #2
    Join Date
    Nov 2003
    Posts
    1,487
    Take a look at this Access exampe. I gives you an idea of how this can be done:
    Code:
    color=green]'The following example first creates a new form based on an Orders table.
    'It then uses the CreateControl function to create a text box control and an attached label control on the form.[/color]
    
    Sub NewControls()
    	Dim frm As Form
    	Dim ctlLabel As Control, ctlText As Control
    	Dim intDataX As Integer, intDataY As Integer
    	Dim intLabelX As Integer, intLabelY As Integer
    
    	' Create new form with Orders table as its record source.
    	Set frm = CreateForm
    	frm.RecordSource = "Orders"
    	' Set positioning values for new controls.
    	intLabelX = 100
    	intLabelY = 100
    	intDataX = 1000
    	intDataY = 100
    	' Create unbound default-size text box in detail section.
    
                    Set ctlText = CreateControl(frm.Name, acTextBox, , "", "", _
    	intDataX, intDataY)
    	' Create child label control for text box.
    	Set ctlLabel = CreateControl(frm.Name, acLabel, , ctlText.Name, _
    	"NewLabel", intLabelX, intLabelY)
    	' Restore form.
    	DoCmd.Restore
    End Sub
    And here are the Constants you can use:

    ControlType Property, CreateControl and CreateReportControl Functions Constants

    You can use one of the following constants with the ControlType property and the CreateControl and CreateReportControl functions to specify the control type:

    acBoundObjectFrame
    acOptionButton
    acCheckBox
    acOptionGroup
    acComboBox
    acPage
    acCommandButton
    acPageBreak
    acCustomControl
    acRectangle
    acImage
    acSubform
    acLabel
    acTabCtl
    acLine
    acTextBox
    acListBox
    acToggleButton
    acObjectFrame

    Section Property, CreateControl and CreateReportControl Functions Constants

    You can use one of the following constants with the Section property and the CreateControl and CreateReportControl functions to specify a section on a form or report:

    acDetail
    acGroupLevel2Header
    acFooter
    acHeader
    acGroupLevel1Footer
    acPageFooter
    acGroupLevel1Header
    acPageHeader
    acGroupLevel2Footer

    Hope this helps....

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •