Button goes to reference in combo box

mm07nkb

Registered User.
Local time
Today, 22:13
Joined
Sep 1, 2011
Messages
23
Hi

I have a combo box on a form. I also have a button which when pressed should go to the form of the 'JobReference' in the combo box.

My form the combo box and button is on is called 'FRMBrowse'
The combobox contains 'JobReference' from a table
The button is called 'BTNBrowse'

The form it goes to is 'FRMVacancies'

In the where condition on the button i currently have:

[Forms]![FRMBrowse]![BTNBrowse]=[JobReference]

But this is currently just bring up a blank 'FRMVacancies' form.

The 'JobReference' is a text field in my table.

How do i get it to link to the form with the jobreference on?

Any help would be great!
 
Ive tried that before and i couldnt get it to work?
 
I'm not psychic ;) It would be good to see what you wrote (as previously asked).
 
sorry i had writted the where condition in before.

On the button I created a macro.
It was an 'OpenForm' macro with:

Form Name: FRMVacancies
View: Form
Filter Name:
Where Condition: [Forms]![FRMBrowse]![BTNBrowse]=[JobReference]
Data Mode:
Window Mode: Normal

I hadnt created a code.

Does this help?
 
The where condition is applied on the recordsource of the form being opened.

So instead of [Forms]![FRMBrowse]![BTNBrowse] you want the name of the field.

I've never done it in a macro, but in VBA I would use this format:

Code:
DoCmd.OpenForm("frmFormName",acNormal, ,"[FieldName] = " & ControlName)

Obviously including #s or 's if the data type of that field requires it. but my point is with the macro builder I'm not sure if you should be concatonating it like a string rather than just doing [field]=[control]
 
I'm sure you've taking into consideration what CBrighton mentioned. Here's how you would do it in a macro:
Code:
Form Name: FRMVacancies
View: Form
Filter Name:
[B]Where Condition: [BTNBrowse]=[Forms]![[COLOR=Red]Form Name[/COLOR]]![JobReference][/B]
Data Mode:
Window Mode: Normal
 
ive added that macro in and it still brings up a blank form. Is it because it JobReference is a Text Field? I know i have had to change macros in the past because of this
 
Don't worry about it being string, it will work without the quotes in this context.

Are you sure the criteria you entered in Jobreference should produce records? Have you tested it in a query by manually entering the value?

Did you move into another control after typing into Jobreference? That's how you set the value of a textbox.
 

Users who are viewing this thread

Back
Top Bottom