Results 1 to 3 of 3
  1. #1
    gdboling
    Guest

    Open Form Access 2K

    Is there a way to open a form to grab a field similar to the OpenRecordSet in code? Something like an OpenFormSet command. I need to check the data in a form againsts data in a table before it is written to the table. I can only query data in a table and I need to query the form instead.

  2. #2
    3 Star Lounger
    Join Date
    Dec 2000
    Location
    USA
    Posts
    379
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Open Form Access 2K

    I'm a bit confused here, because if the form is based on the table, what you are seeing should be the data in the table.

    But if the form is open for data entry, such that the record hasn't been written to the table yet, you can reference the value of the text box in the form with: [Forms]![YourFormName]![YourTextboxName]

  3. #3
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Open Form Access 2K

    Are you trying to validate the data or see if it already exists in the table? If so, you're better off looking carefully at your indexes and table relationships.

    Those are the standard method for keeping out duplicate records, but they aren't exactly intuitive. I've known a lot of VB developers who never quite got the hang of table relationships and keys. They're not hard to deal with, they just take thinking sideways a bit.

    If you're using a bound form, you'll find out about the duplicate key or index when you try to save the record and you can trap the error message using error handling. If you're using an unbound form, you can do the same thing by using code to append the record and trapping the resulting duplicate key or index error. In both cases, the error will tell you the record already exists, and you can handle relaying that information to the user in whatever fashion you wish.
    Charlotte

Posting Permissions

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