What's the command you are using and the error generated?
Also paste your output like this..
iwconfig wlan0
wlan0 IEEE 802.11g ESSID

ff/any Nickname:"linux"
Mode:Ad-Hoc Frequency:2.437 GHz Cell: 00:00:00:00:00:00
Bit Rate=54 Mb/s Tx-Power:25 dBm
RTS thr=2347 B Fragment thr=2346 B
Encryption key

ff
Power Management

ff
Link Quality:100/100 Signal level:-69 dBm Noise level:-256 dBm
Rx invalid nwid:0 Rx invalid crypt:0 Rx invalid frag:0
Tx excessive retries:0000 Invalid misc:0000 Missed beacon:0
linux:~ # iwconfig wlan0 mode managed
linux:~ # iwconfig wlan0
wlan0 IEEE 802.11g ESSID

ff/any Nickname:"linux"
Mode:Managed Frequency:2.437 GHz Access Point: 00:00:00:00:00:00
Bit Rate=54 Mb/s Tx-Power:25 dBm
RTS thr=2347 B Fragment thr=2346 B
Encryption key

ff
Power Management

ff
Link Quality:100/100 Signal level:-57 dBm Noise level:-256 dBm
Rx invalid nwid:0 Rx invalid crypt:0 Rx invalid frag:0
Tx excessive retries:0000 Invalid misc:0000 Missed beacon:0
linux:~ # iwconfig wlan0 essid "Days Inn"
linux:~ # iwconfig wlan0
wlan0 IEEE 802.11g ESSID:"Days Inn" Nickname:"linux"
Mode:Managed Frequency:2.462 GHz Access Point: 00:12:17:7B:41:8B
Bit Rate=54 Mb/s Tx-Power:25 dBm
RTS thr=2347 B Fragment thr=2346 B
Encryption key

ff
Power Management

ff
Link Quality:100/100 Signal level:-67 dBm Noise level:-256 dBm
Rx invalid nwid:0 Rx invalid crypt:0 Rx invalid frag:0
Tx excessive retries:0000 Invalid misc:0000 Missed beacon:0
Sorry for the long delay, Got busy over here for a while.