Re: field from other table

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance

From: Steve Schapel (schapel_at_mvps.org.ns)
Date: 06/05/04


Date: Sat, 05 Jun 2004 17:22:18 +1200

Mark,

I can't really answer because I know nothing about what your main form
and subform are all about, or what you want to achieve. However, it
looks like you might want to set the value of all related subform
records... is that right? If so, I would do this...

  Combobox_Afterupdate()
     CurrentDb.Execute "UPDATE SubTable SET YourField ='" & Me.MyCombo &
"' WHERE ID=" & Me.ID
  End Sub

-- 
Steve Schapel, Microsoft Access MVP
Mark R wrote:
>>by making the combobox unbound, and then using a VBA 
> 
> procedure on its After Update event to "put" the data into 
> the subform record.
> 
> Combobox_Afterupdate()
> 
> Set rs = NotMainTableName.recordsetclone
> 
>   With rs
>     .Find "ID = "  & Me.ID
>     .Edit
>     NotMainTableName!insdatafieldname = unbounddataheld
>      .Update
>    End With
> 
> =============
> This is a skeleton ,  but specifically what do I have to 
> do?


Relevant Pages

  • Re: get sum from subform on button(on main for)click
    ... (You could test that by adding a Stop before the MsgBox. ... Display the Record Selector so you can see whether the subform record is dirty or not. ... > These do update the subform totals in the subform footer, ...
    (microsoft.public.access.modulesdaovba)
  • RE: Getting data from a subform into an Excel template
    ... > subform is a Select Query of Orders and OrderDetail tables. ... > I have a "Print Invoice" button on the Orders form which opens an Excel ... and can even populate the first line of the invoice detail ... > to programatically access each subform record in turn. ...
    (microsoft.public.access.modulesdaovba)
  • Re: Required Field at Subform level
    ... When you enter the subform record, ... foreign key matches the primary key of the main form, ... the message will be MsgBox "You must enter a PO#." ...
    (microsoft.public.access.formscoding)
  • Re: Dirty forms...
    ... > If you are trying to prevent the user entering subform record before the ... >> field and a box called WOref that is needed for each record. ...
    (microsoft.public.access.modulesdaovba)
  • Re: Dirty forms...
    ... If you are trying to prevent the user entering subform record before the ... Private Sub Form_BeforeInsert ... > field and a box called WOref that is needed for each record. ...
    (microsoft.public.access.modulesdaovba)