From: Julie on
I can not get the Combo Box Wizard to help me create the code to find a
record on my form. As such, I need to write the code myself...but I could
use some help!

Form Name is TEST
Has fields: SettingValue (text box), Comments (text box), and Event (combo
box).

The records that this form should display are the results of a query named
"ValuesForOneSetting"

When the user selects an event from the Events combo box, I would like the
form to update to show the appropriate SettingValue and Comments for that
event.

Hoping for some help!
-Julie
From: Ken Snell [MVP] on
The form's recordsource query needs to be this:

SELECT * FROM ValuesForOneSetting
WHERE [Event]=Forms!TEST!Event;

On the AfterUpdate event of the Event combo box, use code similar to this to
requery the form:

Private Sub Event_AfterUpdate()
Me.Requery
End Sub


--

Ken Snell
<MS ACCESS MVP>

"Julie" <Julie(a)discussions.microsoft.com> wrote in message
news:E2DD35F4-9010-4ABA-A3E1-BAD3FB10BD22(a)microsoft.com...
>I can not get the Combo Box Wizard to help me create the code to find a
> record on my form. As such, I need to write the code myself...but I could
> use some help!
>
> Form Name is TEST
> Has fields: SettingValue (text box), Comments (text box), and Event (combo
> box).
>
> The records that this form should display are the results of a query named
> "ValuesForOneSetting"
>
> When the user selects an event from the Events combo box, I would like the
> form to update to show the appropriate SettingValue and Comments for that
> event.
>
> Hoping for some help!
> -Julie


From: Julie on
Ken,

Thank you for your help. I was unable to get the Requery to do anything,
but found some other posts that suggest using something like:
Me![textfield1_to_update].value = Me![combobox_name].column(x)

That works to update the fields, but it is actually CHANGING the values
instead of finding the record that I select in the combo box. Is this
happening because of the code I am using?

Do you have any suggestions for how to get the form to navigate to a new
record instead of changing the values of the current one?

Thanks in advance!
-Julie

"Ken Snell [MVP]" wrote:

> The form's recordsource query needs to be this:
>
> SELECT * FROM ValuesForOneSetting
> WHERE [Event]=Forms!TEST!Event;
>
> On the AfterUpdate event of the Event combo box, use code similar to this to
> requery the form:
>
> Private Sub Event_AfterUpdate()
> Me.Requery
> End Sub
>
>
> --
>
> Ken Snell
> <MS ACCESS MVP>
>
> "Julie" <Julie(a)discussions.microsoft.com> wrote in message
> news:E2DD35F4-9010-4ABA-A3E1-BAD3FB10BD22(a)microsoft.com...
> >I can not get the Combo Box Wizard to help me create the code to find a
> > record on my form. As such, I need to write the code myself...but I could
> > use some help!
> >
> > Form Name is TEST
> > Has fields: SettingValue (text box), Comments (text box), and Event (combo
> > box).
> >
> > The records that this form should display are the results of a query named
> > "ValuesForOneSetting"
> >
> > When the user selects an event from the Events combo box, I would like the
> > form to update to show the appropriate SettingValue and Comments for that
> > event.
> >
> > Hoping for some help!
> > -Julie
>
>
>
From: Ken Snell [MVP] on
Is the combo box "Event" bound to a field? If it is, the value in that field
will be changed whenever you make a change in the combo box. You must use an
unbound combo box in the form's header section for the "find" action.

Did you set the form's RecordSource to the query that I posted?
--

Ken Snell
<MS ACCESS MVP>



"Julie" <Julie(a)discussions.microsoft.com> wrote in message
news:A5B95DEF-A656-4434-8E1F-9C0EDDD5381B(a)microsoft.com...
> Ken,
>
> Thank you for your help. I was unable to get the Requery to do anything,
> but found some other posts that suggest using something like:
> Me![textfield1_to_update].value = Me![combobox_name].column(x)
>
> That works to update the fields, but it is actually CHANGING the values
> instead of finding the record that I select in the combo box. Is this
> happening because of the code I am using?
>
> Do you have any suggestions for how to get the form to navigate to a new
> record instead of changing the values of the current one?
>
> Thanks in advance!
> -Julie
>
> "Ken Snell [MVP]" wrote:
>
>> The form's recordsource query needs to be this:
>>
>> SELECT * FROM ValuesForOneSetting
>> WHERE [Event]=Forms!TEST!Event;
>>
>> On the AfterUpdate event of the Event combo box, use code similar to this
>> to
>> requery the form:
>>
>> Private Sub Event_AfterUpdate()
>> Me.Requery
>> End Sub
>>
>>
>> --
>>
>> Ken Snell
>> <MS ACCESS MVP>
>>
>> "Julie" <Julie(a)discussions.microsoft.com> wrote in message
>> news:E2DD35F4-9010-4ABA-A3E1-BAD3FB10BD22(a)microsoft.com...
>> >I can not get the Combo Box Wizard to help me create the code to find a
>> > record on my form. As such, I need to write the code myself...but I
>> > could
>> > use some help!
>> >
>> > Form Name is TEST
>> > Has fields: SettingValue (text box), Comments (text box), and Event
>> > (combo
>> > box).
>> >
>> > The records that this form should display are the results of a query
>> > named
>> > "ValuesForOneSetting"
>> >
>> > When the user selects an event from the Events combo box, I would like
>> > the
>> > form to update to show the appropriate SettingValue and Comments for
>> > that
>> > event.
>> >
>> > Hoping for some help!
>> > -Julie
>>
>>
>>


 | 
Pages: 1
Prev: Runtime error 2220
Next: Fill fields automatically