Results 1 to 4 of 4
  1. #1
    Join Date
    Jan 2004
    Posts
    100

    Unanswered: using form to edit table - catch 22?

    I am trying to use a form to edit a table as well as have related items from a query show on the form as well.

    It seems if I make the record source the table I am editing I can edit the table but not see the values from the query.

    If I make the query the record source then I can see the values from the query but the values from the table no longer show up.

    If I add the fields from the table (the one I want to edit) to the query then all values show up nicely but I cannot edit the table from the form.

    I also tried using the form wizard to use both fields from the table and the query but I get an error before I even finish the wizard.

    (the properties for the form are set to allow edits)

    How can I solve this problem?

    Thanks!

    Norm
    Last edited by norm801; 02-11-04 at 17:58.

  2. #2
    Join Date
    Dec 2002
    Posts
    117

    Re: using form to edit table - catch 22?

    How can I solve this problem?

    Thanks!

    Hello Norm.

    This is a little bit involved. If you post some table and field names of the data you are trying to get the query to display, we could help you. Leave the record source of the form pointing to the table. We are going to insert some code that will pull the data in for you. Let us know so we can help.

  3. #3
    Join Date
    Aug 2003
    Posts
    47
    Very common sutuation.

    To fill form's controls with values from a second table I usually use:
    DLookup("[Field Name]","[Table Name]","[*condition*]=" & *criteria*)
    where *condition* or *criteria* can be table's index, vb variable, value of another form's control etc...

    To save changed values from form's controls to second table:
    DoCmd.RunSql "UPDATE [Table Name] SET [Field Name] =" & ControlName & "WHERE *condition*=" & *criteria*

    To Load values I use Form_Load event procedure, to save them Form_Unload.

    I hope this helps.
    Last edited by sup; 02-12-04 at 00:59.
    F..ck it, gimme a beer... Jimi Hendrix RULES!

  4. #4
    Join Date
    Jan 2004
    Posts
    100

    Re: using form to edit table - catch 22?

    Originally posted by jmonroe
    How can I solve this problem?

    Thanks!

    Hello Norm.

    This is a little bit involved. If you post some table and field names of the data you are trying to get the query to display, we could help you. Leave the record source of the form pointing to the table. We are going to insert some code that will pull the data in for you. Let us know so we can help.
    This is the table I am trying to edit via form.
    Table: Forecasts

    pr_ppProjectID......HoursForecast1.....HoursForeca st2
    CS14578...............45.......................75
    PJ981233..............55........................90

    Query results:
    pr_ppProjectID......pr_ppClientName
    CS14578...............IBM
    PJ981233..............AT&T

    The form should show info from the query yet allow me to edit the data on the Forecasts table.

    Thanks.

Posting Permissions

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