PC Review


Reply
Thread Tools Rate Thread

Can't create new record in subform

 
 
dee
Guest
Posts: n/a
 
      22nd Dec 2006
I have a main form "FmLeads".
It contains a field "Salesman" which has an 'After Change' Event
Procedure.

The Main form "FmLeads", contains a subform "FmDispoHistory". It
displays all historic Salesman changes in continuous form format.

It is related to with ONE "FmLeads" record -->> MANY "FmDispoHistory"
records via an ID field.

I need the Salesman 'After Change' Event Procedure on the main form to
add a new record to the "FmDispoHistory" subform, and then to assign
the value of the "Salesman" field from the main form to the "Salesman"
field in the subform.

Could someone help me with a few lines of VB code that can do tjhis?
Thank You

 
Reply With Quote
 
 
 
 
Steve Schapel
Guest
Posts: n/a
 
      23rd Dec 2006
Dee,

I assume you mean the After Update event - there is no 'After Change'?

While on the topic of terminology, forms don't have fields. They have
controls, which may or may not be bound to a field in the form's
underlying record source table or query.

In the case of your Salesman control, am I correct in my guess that it
is a combobox? And am I correct in my guess that it is unbound? And am
I correct in my guess that the Salesman data is a text data type? If
so, the code might look something like this...

CurrentDb.Execute "INSERT INTO DispoHistory ( ID, Salesman )" & _
" VALUES ( " & Me.ID & ", " & """" & Me.Salesman & """" & " )",
dbFailOnError
Me.FmDispoHistory.Requery

If something like this doesn't do it for you, please post back with
further details, with specific examples.

--
Steve Schapel, Microsoft Access MVP

dee wrote:
> I have a main form "FmLeads".
> It contains a field "Salesman" which has an 'After Change' Event
> Procedure.
>
> The Main form "FmLeads", contains a subform "FmDispoHistory". It
> displays all historic Salesman changes in continuous form format.
>
> It is related to with ONE "FmLeads" record -->> MANY "FmDispoHistory"
> records via an ID field.
>
> I need the Salesman 'After Change' Event Procedure on the main form to
> add a new record to the "FmDispoHistory" subform, and then to assign
> the value of the "Salesman" field from the main form to the "Salesman"
> field in the subform.
>
> Could someone help me with a few lines of VB code that can do tjhis?
> Thank You
>

 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
adding a new record at subform should update an existing record (not create new record) Mark Kubicki Microsoft Access Form Coding 1 16th Jan 2009 08:34 AM
Re: Create new record for the subform Dirk Goldgar Microsoft Access Forms 1 11th Sep 2008 07:06 PM
Can't create new record in subform dee Microsoft Access Form Coding 2 22nd Dec 2006 03:15 PM
Can't create new record in subform dee Microsoft Access Forms 0 22nd Dec 2006 01:32 AM
Create new record from a form and a subform w/ subform pre-populat =?Utf-8?B?bGFtYmNob3BzMjE4?= Microsoft Access 0 13th Jan 2005 06:53 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 11:14 AM.