Problem With a Query on a Form

ddrew

seasoned user
Local time
Today, 09:40
Joined
Jan 26, 2003
Messages
911
I have a DB fo Dog Traininf and Breeding, but Im having a problem with a query. Just wondered if someone could take a quick peek for me.

Open up frm_Profile, choose one of the dogs from the list box then the Breeding tab. Choose a contact from the drop dowm list and you get a pop up askig for a OwnerID. This is something to do with the cbo_DogsName.

What Im trying to do is is populate the cbo_DogsName with a list of dogs which is determined by the which ones are associated with the owner.

When I choose a contact, the onwer ID is populated but the cbo_DogName dosent appear to read it!
 

Attachments

ddrew: I don't have access 2007, (Access 2002) so I will try to guess the solution from what you have written. Combos can only display one record, so if an owner has two dogs, which one does the combo display. There are two ideas that come to mind, perhaps you need "cascading" combos where the dog combo is filtered by the selected contact; or more fields in the contacts combo. The rowsource for the contacts could be modified to include that person's dogs. I prefer the latter. So if you want, modify the rowsource and make it a query with the contacts table and dog name table. If an owner has two dogs, it will show his name twice and each dog name. Pick the one you want and the contact name will display in the combo and put the dogs name into a locked text box for display purposes. You can also grab the dogs ID number. Sample code is like this.
select tblContact.ContactID, tblContactName, tblDog.DogID, tblDog.DogName from tblContact inner join tblContact on tblcontact.contactID = tblDog.ContactID orderby tblContactName, tblDogName

For the contact combo, the column number is four, the widths are 0;2;0;1 inches.
In the afterupdate event you put code to shoot the dogs name into the text box
me.dogname.value = me.contactcombo.column(3)

Sorry again that I can't open your example. Let me know how this works out.
Cheers
Privateer
 
Hi, thanks for the reply, I added a 2003 version
 

Attachments

Oh.

I'm using a Laptop with a maximum resolution of 1366 x 768 and I can't see all of your form, most especially the tabs. I've hidden my taskbar and minimised the Access ribon (v2010) to no avail.

You may want to check that others can use the forms.
 
should be able to see it in design view , its just that Ive diabled the slider bars thats all. feel free to go into design and turn them on
 
I ended up changing frm_Profile to a PopUp and it allowed me to navigate the form sufficiently to look around.

From what I can see there are two problems with the combobox cbo_MatingDog on the form frm_Mating.

1) The query has a criteria linked to the form frm_Mating. You are now using the form as a subform under frm_Profile, so the query now needs to link to [Forms]![frm_Profile]![frm_Mating]! rather than [Forms]![frm_Profile]!.

2) You've linked to the criteria to a field called [Hidden OwnerID] whereas it is a hidden field called [OwnerID].

Therefore the criteria should be [Forms]![frm_Profile]![frm_Mating]![OwnerID] rather than [Forms]![frm_Mating]![Hidden OwnerID]

I hope this helps.


ETA: Of course, Scrollbars. Doh!
 
Thats a Doh! for me as well, loads of subforms and I just didn't see it from the right point of view. Thanks for your help.:o
 

Users who are viewing this thread

Back
Top Bottom