friggin combobox unbound form

klr397

Registered User.
Local time
Yesterday, 17:04
Joined
Dec 13, 2005
Messages
30
I would like to have a form with a combo box open and then when a company is clicked on i would like for my report to open showng all those listings. I have the query and the report and the form but how do i get them to all work together they are not playing nice.
 
You need to use the WhereCondition argument of the OpenReport command either in the AfterUpdate event of the ComboBox or in the code under a Command Button. How do you run the report now? Can you post any code for us to review.
 
try adding this to the on click event of your command button

Dim strWhereClause as string
Dim strComboField = forms![FormName].[comboboxname]

'Remove single quotes if not text
strWhereClause = "Fieldname = '" & strComboField & "'"

DoCmd.OpenReport "rptReportName", acViewPreview, , strWhereClause

DoCmd.Maximize
Reports("rptReportName").Visible = True
Reports("rptReportName").ZoomControl = 80
 
OK that seems to be almost working but im dealing with a duplicate problem in my combo box now is there any way to use the properties to not allow dups?

the problem is that the table im using shows all the job orders for evreyone so some companies are on there like 30 times and some only 1 so im getting all these repeats
 
Put your form in Design Mode
Right click on your combo
Go to Properties, Data, Row Source.
Click ...
Right click on a field in the query for your combo box and click 'Total' so that you group according to the values you want.
Close without saving, and when prompted save.

HTH,

J.
 
Forgot to mention... you should create a query for your combo instead of the table. The query will reference the table, but group by the fields that you want.

J.
 
syntex error
missing operator in query expression
combo name ='name of compnay i chose'

Jibbadiah said:
Forgot to mention... you should create a query for your combo instead of the table. The query will reference the table, but group by the fields that you want.

J.
 
I have to go to the pub for a colleagues leaving do.
Take a copy of your db.
Remove any personal info.
Put in a couple of sample records.
Save it as Access 97 and post it here.
I will take a look and fix for you tomorrow.
 
i can't really do that cause im an intern and the thing is friggin huge. i figgured out however where the root of my problem is.

My Job order table combines the name of company and the contact which means some companies are uneccasarily listed twice so theresa serious like matching problem or something. whoever created this database makes my head hurt. Im giving up on that litttle problem for awhile and ill move on to something else. thank you however for all the help.

Katie
 
Katie,

It isn't as difficult to post a db as you might think.
Create a new db.
Open your existing db.
Split them on your screen, so you can see both.
Drag and drop each item that you need (form, report, any reliant queries and table structures) from your existing to your new.
(It won't mess anything up in your existing).
Take a copy of the table from your existing, 'paste special' to the new db but only paste the structure of the table (it will give you this option). That way you have a copy, without taking across any of the records.

It will only take a maximum of a couple of minutes.

Zip and post the copy here - Access 97.

Note: You should always do developmental work in a copy of your db... otherwise you may accidentally balls it up.

J.
 
lol. i do work mostly in a developmental database. because i would as you say ball it up.
 
klr397 said:
lol. i do work mostly in a developmental database. because i would as you say ball it up.


i zipped it and it was 7,000 kb. ill try to pick ou just the stuff youll need and post it but im working on something at the momment. thanks for being so helpful.
 
Most people on this website have been really helpful... I'm just paying back for the time that they have given me.

Try compacting the db before you zip it.

Remember that loads of ppl get to see this site, so don't include any customer/client data.
 

Users who are viewing this thread

Back
Top Bottom