What is quicker or better?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Newbie

    What is quicker or better?

    Hi all,

    I have a access 2000 database with linked tables to a access 2000 backend
    database. The performance is really slow. I am looking for the best way
    to open a form to add a new record without retrieving the full dataset.
    In my sample below I have two options I could think of, is there any
    important difference? Which one is better or quicker to use? Am I on the
    right track?

    Thanks and sorry for being a newbie.

    Newbie.


    Private Sub cmdObservationR ecords_Click()
    On Error GoTo Err_cmdObservat ionRecords_Clic k

    Dim stDocName As String
    Dim stLinkCriteria As String

    stDocName = "frmObservation "
    DoCmd.OpenForm stDocName, , , stLinkCriteria


    ' -- Option 1 --

    Forms!frmObserv ation.DataEntry = True

    ' -- Option 2 --

    ' DoCmd.GoToRecor d acDataForm, stDocName, acNewRec


    Exit_cmdObserva tionRecords_Cli ck:
    Exit Sub

    Err_cmdObservat ionRecords_Clic k:
    MsgBox Err.Description
    Resume Exit_cmdObserva tionRecords_Cli ck

    End Sub
  • Albert D. Kallal

    #2
    Re: What is quicker or better?

    I would say both of those approach are going to be not very good, and both
    will probably be about the same.

    I would actually open the form in add mode, so the form goes right to a new
    record.

    In both of your examples, you first load the form. and THEN go jump into add
    mode.

    Also, you have declared a variable stLinkCritiera and you never use it. I
    would suggest you dump that stuff that you never use.

    Anyway, as mentioned, I would jump the form right into add mode.

    Hence, I would use:
    [color=blue]
    > Dim stDocName As String
    >
    > stDocName = "frmObservation "
    > DoCmd.OpenForm "OpenForm",,,,a cFormAdd
    >[/color]

    If you only want the user to enter ONE record, then I would turn off the
    forms "allow additions", as then the above will only over ride that setting
    for one record (which is ideal). I would also suggest that you set the forms
    cycle property to current record, and thus the tab key will go round and
    round in the current screen, and not jump to a new records (this also
    applies to the page up/down keys, and also the mouse wheel).



    --
    Albert D. Kallal (MVP)
    Edmonton, Alberta Canada
    kallal@msn.com




    Comment

    Working...