Adding a new record to a form whose record source is a listbox 
Author Message
 Adding a new record to a form whose record source is a listbox

I have an unbound form with a tab control that displays a subform. The
subform's recordsource comes from a linked listbox. When I select an
item in my listbox the subform displays the appropriate record
information. What I'm trying to do is figure out how to add a new record
using the subform to gather the detail and add the bound value to the
listbox so it shows up there. I really don't know where to begin. Any
suggestions? Please be as specific as possible.

Thanks a lot



Wed, 20 Jul 2005 00:47:41 GMT  
 Adding a new record to a form whose record source is a listbox
If I am to understand correctly, you are trying to add a
record to the subform that is based on the unbound field
on the parent form?  And you want the unbound field to be
automatically updated in the record you are adding?  right?

If this is the case, on the OnChange event in the first
field in the subform to be populated, you can enter this
code:

(field on subform to be updated).value = me.parent.form.
(unboundfield on the parent form).value

I hopes this helps...

Quote:
>-----Original Message-----
>I have an unbound form with a tab control that displays a
subform. The
>subform's recordsource comes from a linked listbox. When
I select an
>item in my listbox the subform displays the appropriate
record
>information. What I'm trying to do is figure out how to
add a new record
>using the subform to gather the detail and add the bound
value to the
>listbox so it shows up there. I really don't know where
to begin. Any
>suggestions? Please be as specific as possible.

>Thanks a lot

>.



Wed, 20 Jul 2005 01:20:59 GMT  
 Adding a new record to a form whose record source is a listbox
Hmmmmmm, I'm not sure if I understand what you said. However, based on
the code you supplied I don't think it would do what I'm trying to
achieve. I'll try and explain again in brief statements.

Form A is unbound
Form A has a listbox control that's record source is based on a query.
The bound field is contactID
Form A has a Tab-control with 3 tabs or pages.
Each page on the tab control contains a subform
Each subforms' recordsource is linked to the listbox therefore
displaying the data for the contactID that is selected in the listbox.

What I'm trying to do:
Determine a way to add a new contact using the subform to gather the details
Update the listbox to shown the new contact added.

Thanks

Quote:

>If I am to understand correctly, you are trying to add a
>record to the subform that is based on the unbound field
>on the parent form?  And you want the unbound field to be
>automatically updated in the record you are adding?  right?

>If this is the case, on the OnChange event in the first
>field in the subform to be populated, you can enter this
>code:

>(field on subform to be updated).value = me.parent.form.
>(unboundfield on the parent form).value

>I hopes this helps...

>>-----Original Message-----
>>I have an unbound form with a tab control that displays a

>subform. The

>>subform's recordsource comes from a linked listbox. When

>I select an

>>item in my listbox the subform displays the appropriate

>record

>>information. What I'm trying to do is figure out how to

>add a new record

>>using the subform to gather the detail and add the bound

>value to the

>>listbox so it shows up there. I really don't know where

>to begin. Any

>>suggestions? Please be as specific as possible.

>>Thanks a lot

>>.



Wed, 20 Jul 2005 02:22:55 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Selecting new record in listbox after record is added

2. New record added to listbox, but won't load rec in form when selec

3. adding new records and accessing records from form code

4. Adding a new record by copying record already on the form

5. Purging Records When New Year Record is Added to Form

6. Opening a form related to current record, adding new record

7. Add new record and delete record from a form button

8. add new record and view read-only old records from same form

9. Stopping a user add a new record after adding a record

10. I am attempting to add new records to a SQL Server 7 database from Microsoft


 
Powered by phpBB® Forum Software © phpBB Group