Welcome to SPN

Register and Join the most happening forum of Sikh community & intellectuals from around the world.

Sign Up Now!

Conditional Column Property Change

Discussion in 'Information Technology' started by anasser, Nov 12, 2005.

  1. anasser

    anasser
    Expand Collapse
    Guest

    In my Access 2002 database, I have a table that the users call from a
    button. My question is: How can I make the data in a column on that
    table defaulting to only one value based on a specific criterion in my
    VBA code, or have it as any normal column based on other criteria in my
    VBA code without putting the table in a form.
    Example:
    Table A structure:
    Column1 Column2 Column3 Column4

    VBA Button Click:

    if x = 1 then
    'Code to make entries to Column3 limited to the value "00000000"
    end if

    if x = 2 then
    'Code to make entries to Column3 unlimited and normal like all the
    rest of the columns
    end if

    Any ideas on this matter is appreciated,

    Thanks
     
  2. Loading...

    Similar Threads Forum Date
    Inspirational Unconditional love for the Guru Videos Sep 4, 2010
    General Unconditional Love Hard Talk Jun 28, 2008
    Pure and Unconditional Love for God Gurmat Vichaar Feb 18, 2008
    SGPC voter forms have caste column Hard Talk Jun 13, 2010
    Sikh News The Faith Column (The New Statesman) Breaking News Jun 25, 2007

  3. Van T. Dinh

    Van T. Dinh
    Expand Collapse
    Guest

    If I read your question correctly, you want to do this in the DatasheetView
    of the Table, NOT in a Form?

    DatasheetView of the Table doesn't not have Events which you can hook your
    VBA code into to execute the code. Hence it is not possible. In fact, I
    don't even know how you can have a CommandButton on the DatasheetView of the
    Table???

    You can use a Form in DatasheetView instead.

    --
    HTH
    Van T. Dinh
    MVP (Access)



    "anasser" <anasser8@gmail.com> wrote in message
    news:1131743411.645710.65420@g14g2000cwa.googlegroups.com...
    > In my Access 2002 database, I have a table that the users call from a
    > button. My question is: How can I make the data in a column on that
    > table defaulting to only one value based on a specific criterion in my
    > VBA code, or have it as any normal column based on other criteria in my
    > VBA code without putting the table in a form.
    > Example:
    > Table A structure:
    > Column1 Column2 Column3 Column4
    >
    > VBA Button Click:
    >
    > if x = 1 then
    > 'Code to make entries to Column3 limited to the value "00000000"
    > end if
    >
    > if x = 2 then
    > 'Code to make entries to Column3 unlimited and normal like all the
    > rest of the columns
    > end if
    >
    > Any ideas on this matter is appreciated,
    >
    > Thanks
    >
     
  4. anasser

    anasser
    Expand Collapse
    Guest

    the button is on a different form that closes the form and opens the
    table. I was thinking maybe its possible to edit the table properties
    in the code of the button before The table is loaded...is that possible?
     
  5. Van T. Dinh

    Van T. Dinh
    Expand Collapse
    Guest

    While it is possible to modify the Table, it is much easier to open the
    DatasheetView of a Form (which will look like the DatasheetView of the
    Table) and you can set default value, disable / enable the Control that is
    bound to the required Field you want to restrict / unrestrict and also use
    the BeforeUpdate Event to validate the data entered!

    --
    HTH
    Van T. Dinh
    MVP (Access)



    "anasser" <anasser8@gmail.com> wrote in message
    news:1131774267.261531.314740@g49g2000cwa.googlegroups.com...
    > the button is on a different form that closes the form and opens the
    > table. I was thinking maybe its possible to edit the table properties
    > in the code of the button before The table is loaded...is that possible?
    >
     

Share This Page