PC Review


Reply
Thread Tools Rate Thread

Edit Combo Box

 
 
Bill
Guest
Posts: n/a
 
      10th Feb 2009
I have a combo box which I use to grab a list of names. I wanted to create a
button that would allow me to edit the name choosen should it be necessary.

So I created my button and wrote a simple macro... Well it doesn't want to
work for me. Heres the macro:

Action: OpenForm
Form Name: FRM_TM_Information
View: Form
Filter Name: ="[NameofPerson]=" & [NameofPerson1]
Data Mode:
Window Mode: Normal

Any help is always appreciated! Thanks
Where condition:
 
Reply With Quote
 
 
 
 
Jeanette Cunningham
Guest
Posts: n/a
 
      11th Feb 2009
Hi Bill,
If NameofPerson1 is a text field you will need a different syntax, like this
Filter Name: ="[NameofPerson]='" & [NameofPerson1]& "'"

expanding the quotes to make it easier to read, we get
' " & [NameofPerson1]& " ' "

Other things to check:
Check the spelling is correct for form and field names.
Check that NameofPerson1 is correct for the combo.
I mean that if the combo has more than 1 column, make sure you are using the
correct column in the filter name.


Jeanette Cunningham MS Access MVP -- Melbourne Victoria Australia


"Bill" <(E-Mail Removed)> wrote in message
news:FFF8258B-B4D7-4F24-9B28-(E-Mail Removed)...
>I have a combo box which I use to grab a list of names. I wanted to create
>a
> button that would allow me to edit the name choosen should it be
> necessary.
>
> So I created my button and wrote a simple macro... Well it doesn't want
> to
> work for me. Heres the macro:
>
> Action: OpenForm
> Form Name: FRM_TM_Information
> View: Form
> Filter Name: ="[NameofPerson]=" & [NameofPerson1]
> Data Mode:
> Window Mode: Normal
>
> Any help is always appreciated! Thanks
> Where condition:



 
Reply With Quote
 
Douglas J. Steele
Guest
Posts: n/a
 
      11th Feb 2009
<picky>

If the name of the person includes an apostrophe (D'Arcy, O'Brien, etc.),
using a single quote will fail.

You need to use

Filter Name: ="[NameofPerson]=""" & [NameofPerson1] & """"

(that's three double quotes in a row before the first ampersand, and four
quotes in a row after the second one).

Of course, that will fail in the (granted, unlikely) event that there are
double quotes in the name (think nicknames...), in which case you need
something like

Filter Name: ="[NameofPerson]='" & Replace([NameofPerson1], "'", "''") & "'"

Exagerated for clarity, that's

Filter Name: ="[NameofPerson]= ' " & Replace([NameofPerson1], " ' ", " ' '
") & " ' "

</picky>


--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)


"Jeanette Cunningham" <(E-Mail Removed)> wrote in message
news:%23V%23XNY%(E-Mail Removed)...
> Hi Bill,
> If NameofPerson1 is a text field you will need a different syntax, like
> this
> Filter Name: ="[NameofPerson]='" & [NameofPerson1]& "'"
>
> expanding the quotes to make it easier to read, we get
> ' " & [NameofPerson1]& " ' "
>
> Other things to check:
> Check the spelling is correct for form and field names.
> Check that NameofPerson1 is correct for the combo.
> I mean that if the combo has more than 1 column, make sure you are using
> the correct column in the filter name.
>
>
> Jeanette Cunningham MS Access MVP -- Melbourne Victoria Australia
>
>
> "Bill" <(E-Mail Removed)> wrote in message
> news:FFF8258B-B4D7-4F24-9B28-(E-Mail Removed)...
>>I have a combo box which I use to grab a list of names. I wanted to
>>create a
>> button that would allow me to edit the name choosen should it be
>> necessary.
>>
>> So I created my button and wrote a simple macro... Well it doesn't want
>> to
>> work for me. Heres the macro:
>>
>> Action: OpenForm
>> Form Name: FRM_TM_Information
>> View: Form
>> Filter Name: ="[NameofPerson]=" & [NameofPerson1]
>> Data Mode:
>> Window Mode: Normal
>>
>> Any help is always appreciated! Thanks
>> Where condition:

>
>



 
Reply With Quote
 
Bill
Guest
Posts: n/a
 
      11th Feb 2009
This worked great!!! Thank you both for your input.

"Douglas J. Steele" wrote:

> <picky>
>
> If the name of the person includes an apostrophe (D'Arcy, O'Brien, etc.),
> using a single quote will fail.
>
> You need to use
>
> Filter Name: ="[NameofPerson]=""" & [NameofPerson1] & """"
>
> (that's three double quotes in a row before the first ampersand, and four
> quotes in a row after the second one).
>
> Of course, that will fail in the (granted, unlikely) event that there are
> double quotes in the name (think nicknames...), in which case you need
> something like
>
> Filter Name: ="[NameofPerson]='" & Replace([NameofPerson1], "'", "''") & "'"
>
> Exagerated for clarity, that's
>
> Filter Name: ="[NameofPerson]= ' " & Replace([NameofPerson1], " ' ", " ' '
> ") & " ' "
>
> </picky>
>
>
> --
> Doug Steele, Microsoft Access MVP
> http://I.Am/DougSteele
> (no e-mails, please!)
>
>
> "Jeanette Cunningham" <(E-Mail Removed)> wrote in message
> news:%23V%23XNY%(E-Mail Removed)...
> > Hi Bill,
> > If NameofPerson1 is a text field you will need a different syntax, like
> > this
> > Filter Name: ="[NameofPerson]='" & [NameofPerson1]& "'"
> >
> > expanding the quotes to make it easier to read, we get
> > ' " & [NameofPerson1]& " ' "
> >
> > Other things to check:
> > Check the spelling is correct for form and field names.
> > Check that NameofPerson1 is correct for the combo.
> > I mean that if the combo has more than 1 column, make sure you are using
> > the correct column in the filter name.
> >
> >
> > Jeanette Cunningham MS Access MVP -- Melbourne Victoria Australia
> >
> >
> > "Bill" <(E-Mail Removed)> wrote in message
> > news:FFF8258B-B4D7-4F24-9B28-(E-Mail Removed)...
> >>I have a combo box which I use to grab a list of names. I wanted to
> >>create a
> >> button that would allow me to edit the name choosen should it be
> >> necessary.
> >>
> >> So I created my button and wrote a simple macro... Well it doesn't want
> >> to
> >> work for me. Heres the macro:
> >>
> >> Action: OpenForm
> >> Form Name: FRM_TM_Information
> >> View: Form
> >> Filter Name: ="[NameofPerson]=" & [NameofPerson1]
> >> Data Mode:
> >> Window Mode: Normal
> >>
> >> Any help is always appreciated! Thanks
> >> Where condition:

> >
> >

>
>
>

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Combo List/Edit or Combo Drop-down/edit Takeadoe Microsoft Excel Discussion 4 24th Jul 2007 03:53 PM
Combo Box edit SecretCharacter Microsoft Access Forms 1 21st Dec 2004 03:48 AM
Using combo-box to look up and add/edit ect... Andy G Microsoft Access Form Coding 0 26th Jul 2004 07:05 PM
Allow Edit and Combo box =?Utf-8?B?d29vZA==?= Microsoft Access 2 3rd Apr 2004 11:53 PM
Can't edit Combo Box Brad Microsoft Excel Misc 2 30th Mar 2004 06:18 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 05:30 PM.