Results 1 to 5 of 5

Thread: move to record

  1. #1
    Join Date
    Jun 2002
    Location
    Mpls/St.Paul area
    Posts
    303

    Unhappy Unanswered: move to record

    When the user selects a form to open, the database looks at some controls on the main page and then opens the selected form with link criteria.

    Using a generic function called by the OnOpen event, I look to see whether there are any records or not. If not, I am using ADO to INSERT new record in the table. I pull some of the vital stats from the main page and prefill about five fields.

    Now, how do I get the form to go to that record?

    On open...
    if record count is zero then add a record

    CurrentProject.Connection.Execute strMySQL
    John
    This is the day the Lord has made, I will rejoice and be glad in it.

  2. #2
    Join Date
    Sep 2003
    Location
    MI
    Posts
    3,713
    DoCmd.GoToRecord acDataForm, "YourFormNameHere", acGoTo, Record#Here

  3. #3
    Join Date
    Dec 2003
    Location
    Toronto, Ont. Canada
    Posts
    238

    Post Re: move to record

    Originally posted by jpshay
    When the user selects a form to open, the database looks at some controls on the main page and then opens the selected form with link criteria.

    Using a generic function called by the OnOpen event, I look to see whether there are any records or not. If not, I am using ADO to INSERT new record in the table. I pull some of the vital stats from the main page and prefill about five fields.

    Now, how do I get the form to go to that record?

    On open...
    if record count is zero then add a record

    CurrentProject.Connection.Execute strMySQL
    Is one of the five fields that you are prefilling in the new record the primary key in the table? ...If so, just place the value into a variable at the same time as adding the record, and then after the record is appended, use the Find method of your form's Recordset to go to the record where the value in the variable matches the field value in the table...

    It's difficult for me to get more specific without seeing the code and/or some sample data... but I hope this helps...

  4. #4
    Join Date
    Jun 2002
    Location
    Mpls/St.Paul area
    Posts
    303
    Thank you, M Owen
    Could you elaborate on the final element please?

    Record#Here
    John
    This is the day the Lord has made, I will rejoice and be glad in it.

  5. #5
    Join Date
    Jun 2002
    Location
    Mpls/St.Paul area
    Posts
    303

    Re: move to record

    Thank you Trudi. No, the ID is not one of the fields being appended.
    This was all much easier when I relied on the recordset clone in DAO. But I am trying to migrate to ADO.
    Attached Files Attached Files
    John
    This is the day the Lord has made, I will rejoice and be glad in it.

Posting Permissions

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