A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Cascading combos with additional data



 
 
Thread Tools Display Modes
  #1  
Old December 10th, 2005, 02:15 AM posted to microsoft.public.access.forms
external usenet poster
 
Posts: n/a
Default Cascading combos with additional data

I have two cascading combo boxes, "Category" and "Model" on a subform in the
form "Employees". These pull from a query named "Available Assets" that list
assets available to choose from. Once an asset is chosen it is assigned to a
username.

The problem I have is that once the two combos are selected the rest of the
assets details to not populate the rest of the form, things like serial,
asset tas, etc.

Another problem is that instead of taking an asset from the "Available
Assets" query it adds a new record. It should only pull from the query, not
add to it.
  #2  
Old December 10th, 2005, 05:57 AM posted to microsoft.public.access.forms
external usenet poster
 
Posts: n/a
Default Cascading combos with additional data

On Fri, 9 Dec 2005 18:15:02 -0800, "Christopher"
wrote:

I have two cascading combo boxes, "Category" and "Model" on a subform in the
form "Employees". These pull from a query named "Available Assets" that list
assets available to choose from. Once an asset is chosen it is assigned to a
username.

The problem I have is that once the two combos are selected the rest of the
assets details to not populate the rest of the form, things like serial,
asset tas, etc.

Another problem is that instead of taking an asset from the "Available
Assets" query it adds a new record. It should only pull from the query, not
add to it.


What's the Recordsource of the form? If the combo boxes are bound to
fields in the Form's recordsource, that's exactly what they SHOULD do:
just update those fields. The serial, asset tas (tag??), etc. should
NOT be stored redundantly in a second table, as a rule; even if you do
have a good reason to do so, just selecting a value from a combo box
won't do so.

Again... what are the RowSources of the combos? What is the
Recordsource of the form? Where are the serial, asset tag, etc.
stored? Do you want the combos to *find an existing record* and
display it, or change the value in an existing record? And what do you
mean by "taking an asset from" - do you want to delete a record from
some other table?

John W. Vinson[MVP]
  #3  
Old December 12th, 2005, 05:30 AM posted to microsoft.public.access.forms
external usenet poster
 
Posts: n/a
Default Cascading combos with additional data

I have tried using a query that pulls only the available assets, meaning they
don't have a "username" attached to the record.

I also tried pulling the records straight from the table "Assets" with a sql
statement bringing only usernames with a null value.

I want to be able to choose for example "Laptop" from the first combo box
"AssetCategoryID".

Then choose "Dell D505" from the second combo box "Model"

Then the other records information like serial number and asset tag, should
appear but they are not. Everything comes from the same table or query. All
it does is add another record instead of selecting the ones without a
username and assigning it to the person.

Here is some code for the forms

Main "Employees" form:
Option Compare Database
Option Explicit
Private Sub Form_Activate()
Me![Add Asset Subform].Requery
End Sub
Private Sub Form_Load()
If Me.OpenArgs = "GotoNew" And Not IsNull(Me![Username]) Then
DoCmd.DoMenuItem acFormBar, 3, 0, , acMenuVer70
End If
End Sub


Employees Add Asset Subform
Option Compare Database
Private Sub AssetCategoryID_AfterUpdate()
Me.Model.Requery
End Sub
  #4  
Old December 12th, 2005, 05:41 AM posted to microsoft.public.access.forms
external usenet poster
 
Posts: n/a
Default Cascading combos with additional data

I just got the form to display all the info from the table. But it still
adds a record instead using a record from the table. This is the rowsource
for the combos.

AssetCategoryID=SELECT [Asset Categories].AssetCategory, [Asset
Categories].AssetCategoryID, Assets.AssetCategoryID, Assets.Username FROM
[Asset Categories] RIGHT JOIN Assets ON [Asset
Categories].AssetCategoryID=Assets.AssetCategoryID GROUP BY [Asset
Categories].AssetCategory, [Asset Categories].AssetCategoryID,
Assets.AssetCategoryID, Assets.Username HAVING (((Assets.Username) Is Null));

Model=SELECT Assets.Model, Assets.AssetCategoryID, Assets.Username FROM
Assets WHERE (((Assets.AssetCategoryID)=Forms!Employees![Add Asset
Subform].Form!AssetCategoryID) And ((Assets.Username) Is Null));
  #5  
Old December 15th, 2005, 06:43 PM posted to microsoft.public.access.forms
external usenet poster
 
Posts: n/a
Default Cascading combos with additional data

I just got the form to display all the info from the table. But it still
adds a record instead using a record from the table. This is the rowsource
for the combos.

AssetCategoryID=SELECT [Asset Categories].AssetCategory, [Asset
Categories].AssetCategoryID, Assets.AssetCategoryID, Assets.Username FROM
[Asset Categories] RIGHT JOIN Assets ON [Asset
Categories].AssetCategoryID=Assets.AssetCategoryID GROUP BY [Asset
Categories].AssetCategory, [Asset Categories].AssetCategoryID,
Assets.AssetCategoryID, Assets.Username HAVING (((Assets.Username) Is Null));

Model=SELECT Assets.Model, Assets.AssetCategoryID, Assets.Username FROM
Assets WHERE (((Assets.AssetCategoryID)=Forms!Employees![Add Asset
Subform].Form!AssetCategoryID) And ((Assets.Username) Is Null));

 




Thread Tools
Display Modes

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

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Excel Macro to Copy & Paste [email protected] Worksheet Functions 0 December 1st, 2005 01:56 PM
Help PLEASE! Not sure what answer is: Match? Index? Other? baz Worksheet Functions 7 September 3rd, 2005 03:47 PM
strategy for data entry in multiple tables LAF Using Forms 18 April 25th, 2005 04:04 AM
VBA Code problem error 9 Speedy General Discussion 19 October 15th, 2004 09:05 PM
Mial merge data base problems Rachael Mailmerge 16 May 21st, 2004 06:22 PM


All times are GMT +1. The time now is 12:39 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.