Datasheet view questions

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • jsb2n@virginia.edu

    #1

    Datasheet view questions

    I haven't developed applications in 2 years (have been doing straight
    SQL Server work) and I am new to developing in Access. I know that
    using the datasheet view of a form is not usually the preferred method
    of end-user access, but it seems appropriate for one of the tables I'm
    using.

    The table contains two columns, MonthStartDate and ClinicDays. The
    user needs to enter the numbers of days the clinic will be open for
    each month. Generally, they enter 3 months at a time (for a quarter),
    but they are allowed to enter as many as 12 months in advance. This
    number of days is used later in the process for calculations.

    1. When they open the form (in datasheet view), I'd like to position
    them at the next month they need to enter. Can anyone tell me how to
    do this?

    2. They should only be allowed to enter days for future months, not
    past. How can I make some of the records read-only?

    3. And how can I make the MonthStartDate column read-only?

    Thanks for helping!
    Jana

  • Phil Stanton

    #2
    Re: Datasheet view questions

    Suggest you use a continuous form rather than a datasheet

    Set the Allow Additions and Allow deletions to "No"
    Set MonthStartDate Locked to True

    Add the following code

    Private Sub ClinicDays_Befo reUpdate(Cancel As Integer)

    ' Stops alteration of ClinicDays on any day before today

    If MonthStartdate < Date Then
    MsgBox "You cant change old data", vbCritical
    Cancel = True
    SendKeys "{ESC}"
    End If

    End Sub

    Private Sub Form_Open(Cance l As Integer)
    ' Goes to the first record where ClinicDays = 0

    DoCmd.GoToContr ol "ClinicDays "
    DoCmd.FindRecor d 0

    End Sub

    <jsb2n@virginia .edu> wrote in message
    news:1129822530 .178679.27700@f 14g2000cwb.goog legroups.com...[color=blue]
    >I haven't developed applications in 2 years (have been doing straight
    > SQL Server work) and I am new to developing in Access. I know that
    > using the datasheet view of a form is not usually the preferred method
    > of end-user access, but it seems appropriate for one of the tables I'm
    > using.
    >
    > The table contains two columns, MonthStartDate and ClinicDays. The
    > user needs to enter the numbers of days the clinic will be open for
    > each month. Generally, they enter 3 months at a time (for a quarter),
    > but they are allowed to enter as many as 12 months in advance. This
    > number of days is used later in the process for calculations.
    >
    > 1. When they open the form (in datasheet view), I'd like to position
    > them at the next month they need to enter. Can anyone tell me how to
    > do this?
    >
    > 2. They should only be allowed to enter days for future months, not
    > past. How can I make some of the records read-only?
    >
    > 3. And how can I make the MonthStartDate column read-only?
    >
    > Thanks for helping!
    > Jana
    >[/color]


    Comment

    Working...