[AccessD] Combo Subform Entries

Hollis,Virginia HollisVJ at pgdp.usec.com
Wed Nov 19 07:14:40 CST 2003


Anyway, I guess I am still doing something wrong because when I add a new
entry it still does not show the new entry as the selection.

When I add a new entry it refreshes back to the first entry in the list. I
set the LocationID to visible on each form so I can see what was happening.
The subform locationID is set to the new entry after I reselect the new
entry, but the main form with the combobox does not.

ComboBox (main form) shows Austin = LocationID 23
Subform LocationID = 23

Add new entry: LocationID should be 24
Main Form shows LocationID = 23
Subform LocationID = 24

Another think I noticed - sometimes when I open the form, the LocationID
shows on the Main form, but not the subform. I close the form & reopen & the
LocationID shows in the subform.

What have I done here??

Virginia


-----Original Message-----
From: Darren DICK [mailto:d.dick at uws.edu.au]
Sent: Tuesday, November 18, 2003 6:57 PM
To: Access Developers discussion and problem solving
Subject: Re: [AccessD] Combo Subform Entries


Hi Virginia
Demo sent off line
If anyone wants a me too then make 'em to d.dick at uws.edu.au
Any me too's direct to this list will be ignored, snubbed and otherwise
shown contempt :-)

See ya

Darren

----- Original Message ----- 
From: "Hollis,Virginia" <HollisVJ at pgdp.usec.com>
To: <accessd at databaseadvisors.com>
Sent: Wednesday, November 19, 2003 7:09 AM
Subject: [AccessD] Combo Subform Entries


> I have a combobox on a main form that is used to select certain records on
> the subform. For example, if you select Car from the combo, the subform
> shows all the records for Car.
>  
> I need to be able to add an entry to the combobox on the main form & have
it
> available for use to add new records. So if I add Jeep to the NotInList
> event of the combobox, Jeep would be in the list, the Combo would show
Jeep,
> & the subform should be blank & ready to add new entries for Jeep.
>  
> I tried Requery, I tried a seperate form for adding new entries to the
list,
> and OnClose of the form, requery the form, but nothing works. The entry is
> in the list, but the subform stays on the previous selections entry. Or
> should the requery go on the After Update of the Combo?
>  
> Virginia
>  
> On NotInList
>  
>     ' Return Control object that points to combo box.
>     Set ctl = Me!cboLocation
>     ' Prompt user to verify they wish to add new value.
>     If MsgBox("Would you like to add '" & NewData & "' to the list?",
> vbYesNo, "Add New Name") = vbYes Then
>         ' Set Response argument to indicate that data is being added.
>         Response = acDataErrAdded
>         ' Add string in NewData argument to table.
>         NewData = DoConv(NewData)
>         strSQL = " INSERT INTO tbl_Location ( Location ) SELECT '" &
> DoConv(NewData) & "'"
>         DoCmd.SetWarnings False
>         DoCmd.RunSQL strSQL
>         ctl.Value = NewData
>         DoCmd.SetWarnings True
>    
>     Else
>         ' If user chooses Cancel, suppress error message and undo changes.
>         Response = acDataErrContinue
>         ctl.Undo
>     End If
> 
> _______________________________________________
> AccessD mailing list
> AccessD at databaseadvisors.com
> http://databaseadvisors.com/mailman/listinfo/accessd
> Website: http://www.databaseadvisors.com
_______________________________________________
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com


More information about the AccessD mailing list