473,765 Members | 2,121 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Problems with Code

Hi All,

Have added a Strconv function to the AfterUpdate event of a field to give me
first letter capitalization (vbProperCase). I have added a msgbox that will
allow me to over-ride where necessary however it does not work.

The code below will allow me to manually type in capitals into the full
string when I hit the "Yes" button, but when I elect "No" the vbProperCase
is not activated and no change is made. Can anyone please help me with my
code, I am teaching myself VBA very slowly and finding it a bit frustrating

Code as follows

Private Sub Company_AfterUp date()
MsgBox "Override Capitalization" , vbYesNo
If "vbYesNo" = "No" Then
Company = StrConv(Company , vbProperCase)

Else

End If

End Sub

Regards

Zellan
Nov 13 '05 #1
8 1715
"Zellan" <Ze****@hotmail .com> wrote in message
news:42******** *************** @news.optusnet. com.au...

Private Sub Company_AfterUp date()
MsgBox "Override Capitalization" , vbYesNo
If "vbYesNo" = "No" Then
Company = StrConv(Company , vbProperCase)

Else

End If


Untested, but along the lines of:

If MsgBox "Override Capitalization" , vbYesNo = vbNo Then
Do something
Else
Do something else
End If

HTH - Keith.
www.keithwilby.com
Nov 13 '05 #2
On Fri, 27 May 2005 19:39:00 +1000, Zellan wrote:
Hi All,

Have added a Strconv function to the AfterUpdate event of a field to give me
first letter capitalization (vbProperCase). I have added a msgbox that will
allow me to over-ride where necessary however it does not work.

The code below will allow me to manually type in capitals into the full
string when I hit the "Yes" button, but when I elect "No" the vbProperCase
is not activated and no change is made. Can anyone please help me with my
code, I am teaching myself VBA very slowly and finding it a bit frustrating

Code as follows

Private Sub Company_AfterUp date()
MsgBox "Override Capitalization" , vbYesNo
If "vbYesNo" = "No" Then
Company = StrConv(Company , vbProperCase)

Else

End If

End Sub

Regards

Zellan


You need to use the MsgBox() function.
Also vbYesNo is a Number constant, so no quotes.

If MsgBox("Overrid e Capitalization" , vbYesNo) = vbNo Then
Company = StrConv(Company , vbProperCase)
etc.

--
Fred
Please only reply to this newsgroup.
I do not reply to personal email.
Nov 13 '05 #3
Thanks for the reply however this does not allow me to have a Yes/No option
just the "OK" button only and the functionality will give me the
vbProperCase only and not allow me to override the text string.

Zellan

"fredg" <fg******@examp le.invalid> wrote in message
news:6t******** *************** *****@40tude.ne t...
On Fri, 27 May 2005 19:39:00 +1000, Zellan wrote:
Hi All,

Have added a Strconv function to the AfterUpdate event of a field to give
me
first letter capitalization (vbProperCase). I have added a msgbox that
will
allow me to over-ride where necessary however it does not work.

The code below will allow me to manually type in capitals into the full
string when I hit the "Yes" button, but when I elect "No" the
vbProperCase
is not activated and no change is made. Can anyone please help me with my
code, I am teaching myself VBA very slowly and finding it a bit
frustrating

Code as follows

Private Sub Company_AfterUp date()
MsgBox "Override Capitalization" , vbYesNo
If "vbYesNo" = "No" Then
Company = StrConv(Company , vbProperCase)

Else

End If

End Sub

Regards

Zellan


You need to use the MsgBox() function.
Also vbYesNo is a Number constant, so no quotes.

If MsgBox("Overrid e Capitalization" , vbYesNo) = vbNo Then
Company = StrConv(Company , vbProperCase)
etc.

--
Fred
Please only reply to this newsgroup.
I do not reply to personal email.

Nov 13 '05 #4
Thanks Keith,

Tried it but it doesnt give me the full functionality, provides an "OK"
message only and executes vbProperCase - wont allow me to override the text
Zellan

"Keith" <ke*********@ba eAWAYWITHITsyst ems.com> wrote in message
news:42******** **@glkas0286.gr eenlnk.net...
"Zellan" <Ze****@hotmail .com> wrote in message
news:42******** *************** @news.optusnet. com.au...

Private Sub Company_AfterUp date()
MsgBox "Override Capitalization" , vbYesNo
If "vbYesNo" = "No" Then
Company = StrConv(Company , vbProperCase)

Else

End If


Untested, but along the lines of:

If MsgBox "Override Capitalization" , vbYesNo = vbNo Then
Do something
Else
Do something else
End If

HTH - Keith.
www.keithwilby.com

Nov 13 '05 #5
On Sat, 28 May 2005 09:04:11 +1000, Zellan wrote:
Thanks for the reply however this does not allow me to have a Yes/No option
just the "OK" button only and the functionality will give me the
vbProperCase only and not allow me to override the text string.

Zellan

"fredg" <fg******@examp le.invalid> wrote in message
news:6t******** *************** *****@40tude.ne t...
On Fri, 27 May 2005 19:39:00 +1000, Zellan wrote:
Hi All,

Have added a Strconv function to the AfterUpdate event of a field to give
me
first letter capitalization (vbProperCase). I have added a msgbox that
will
allow me to over-ride where necessary however it does not work.

The code below will allow me to manually type in capitals into the full
string when I hit the "Yes" button, but when I elect "No" the
vbProperCase
is not activated and no change is made. Can anyone please help me with my
code, I am teaching myself VBA very slowly and finding it a bit
frustrating

Code as follows

Private Sub Company_AfterUp date()
MsgBox "Override Capitalization" , vbYesNo
If "vbYesNo" = "No" Then
Company = StrConv(Company , vbProperCase)

Else

End If

End Sub

Regards

Zellan


You need to use the MsgBox() function.
Also vbYesNo is a Number constant, so no quotes.

If MsgBox("Overrid e Capitalization" , vbYesNo) = vbNo Then
Company = StrConv(Company , vbProperCase)
etc.

--
Fred
Please only reply to this newsgroup.
I do not reply to personal email.


I don't think you understood my reply.
Please post the entire event procedure.
--
Fred
Please only reply to this newsgroup.
I do not reply to personal email.
Nov 13 '05 #6
This is the code I have used and I receive the message with an "OK" button
only and am not able to override the code.

Private Sub Company_AfterUp date()
If MsgBox("Overrid e Capitalization" , vbYesNo = vbNo) Then
Company = StrConv(Company , vbProperCase)

Else

End If

End Sub

Regards and thanks for your help Fred

Zellan

"fredg" <fg******@examp le.invalid> wrote in message
news:1w******** *************** ********@40tude .net...
On Sat, 28 May 2005 09:04:11 +1000, Zellan wrote:
Thanks for the reply however this does not allow me to have a Yes/No
option
just the "OK" button only and the functionality will give me the
vbProperCase only and not allow me to override the text string.

Zellan

"fredg" <fg******@examp le.invalid> wrote in message
news:6t******** *************** *****@40tude.ne t...
On Fri, 27 May 2005 19:39:00 +1000, Zellan wrote:

Hi All,

Have added a Strconv function to the AfterUpdate event of a field to
give
me
first letter capitalization (vbProperCase). I have added a msgbox that
will
allow me to over-ride where necessary however it does not work.

The code below will allow me to manually type in capitals into the full
string when I hit the "Yes" button, but when I elect "No" the
vbProperCase
is not activated and no change is made. Can anyone please help me with
my
code, I am teaching myself VBA very slowly and finding it a bit
frustrating

Code as follows

Private Sub Company_AfterUp date()
MsgBox "Override Capitalization" , vbYesNo
If "vbYesNo" = "No" Then
Company = StrConv(Company , vbProperCase)

Else

End If

End Sub

Regards

Zellan

You need to use the MsgBox() function.
Also vbYesNo is a Number constant, so no quotes.

If MsgBox("Overrid e Capitalization" , vbYesNo) = vbNo Then
Company = StrConv(Company , vbProperCase)
etc.

--
Fred
Please only reply to this newsgroup.
I do not reply to personal email.


I don't think you understood my reply.
Please post the entire event procedure.
--
Fred
Please only reply to this newsgroup.
I do not reply to personal email.

Nov 13 '05 #7
On Sat, 28 May 2005 11:08:46 +1000, Zellan wrote:
This is the code I have used and I receive the message with an "OK" button
only and am not able to override the code.

Private Sub Company_AfterUp date()
If MsgBox("Overrid e Capitalization" , vbYesNo = vbNo) Then
Company = StrConv(Company , vbProperCase)

Else

End If

End Sub

Regards and thanks for your help Fred

Zellan

"fredg" <fg******@examp le.invalid> wrote in message
news:1w******** *************** ********@40tude .net...
On Sat, 28 May 2005 09:04:11 +1000, Zellan wrote:
Thanks for the reply however this does not allow me to have a Yes/No
option
just the "OK" button only and the functionality will give me the
vbProperCase only and not allow me to override the text string.

Zellan

"fredg" <fg******@examp le.invalid> wrote in message
news:6t******** *************** *****@40tude.ne t...
On Fri, 27 May 2005 19:39:00 +1000, Zellan wrote:

> Hi All,
>
> Have added a Strconv function to the AfterUpdate event of a field to
> give
> me
> first letter capitalization (vbProperCase). I have added a msgbox that
> will
> allow me to over-ride where necessary however it does not work.
>
> The code below will allow me to manually type in capitals into the full
> string when I hit the "Yes" button, but when I elect "No" the
> vbProperCase
> is not activated and no change is made. Can anyone please help me with
> my
> code, I am teaching myself VBA very slowly and finding it a bit
> frustrating
>
> Code as follows
>
> Private Sub Company_AfterUp date()
> MsgBox "Override Capitalization" , vbYesNo
> If "vbYesNo" = "No" Then
> Company = StrConv(Company , vbProperCase)
>
> Else
>
> End If
>
> End Sub
>
> Regards
>
> Zellan

You need to use the MsgBox() function.
Also vbYesNo is a Number constant, so no quotes.

If MsgBox("Overrid e Capitalization" , vbYesNo) = vbNo Then
Company = StrConv(Company , vbProperCase)
etc.

--
Fred
Please only reply to this newsgroup.
I do not reply to personal email.


I don't think you understood my reply.
Please post the entire event procedure.
--
Fred
Please only reply to this newsgroup.
I do not reply to personal email.

1) You have not correctly copied the code I gave you.
You moved the closing parenthesis.
You wrote:

If MsgBox("Overrid e Capitalization" , vbYesNo = vbNo) Then
etc.

vbYesNo has a value of 4.
vbNo has a value of 7
so your code equates to:
If MsgBox("Overrid e Capitalization" ,4 = 7) Then ....
which Access equates to:
If MsgBox(""Overri de Capitalization" ,False) Then
...... because 4 does not = 7.
False has a value of 0.
vbOKOnly has a value of 0.
That's why you only get just OK on the message box instead of Yes and
No.

Please change it to what I wrote.
I wrote:
If MsgBox("Overrid e Capitalization" , vbYesNo) = vbNo Then
Now you will get both buttons.

2) Even after you get both buttons, you haven't told Access what to do
if Yes is clicked.
How is Access supposed to know unless you tell it?

Below is how your code should look.
All you need do is add code to the Else portion to tell access what to
do if Yes is selected.

Private Sub Company_AfterUp date()
If MsgBox("Overrid e Capitalization" , vbYesNo) = vbNo Then
Company = StrConv(Company , vbProperCase)
Else
' Tell it what to do if Yes is clicked here
End If
End Sub
--
Fred
Please only reply to this newsgroup.
I do not reply to personal email.
Nov 13 '05 #8
Thank you very much for the code... I really appreciate your reply... I am
only a relative starter to the world of VBA and this will help me
enourmously.

Zellan

"fredg" <fg******@examp le.invalid> wrote in message
news:m0******** *************** ******@40tude.n et...
On Sat, 28 May 2005 11:08:46 +1000, Zellan wrote:
This is the code I have used and I receive the message with an "OK"
button
only and am not able to override the code.

Private Sub Company_AfterUp date()
If MsgBox("Overrid e Capitalization" , vbYesNo = vbNo) Then
Company = StrConv(Company , vbProperCase)

Else

End If

End Sub

Regards and thanks for your help Fred

Zellan

"fredg" <fg******@examp le.invalid> wrote in message
news:1w******** *************** ********@40tude .net...
On Sat, 28 May 2005 09:04:11 +1000, Zellan wrote:

Thanks for the reply however this does not allow me to have a Yes/No
option
just the "OK" button only and the functionality will give me the
vbProperCase only and not allow me to override the text string.

Zellan

"fredg" <fg******@examp le.invalid> wrote in message
news:6t******** *************** *****@40tude.ne t...
> On Fri, 27 May 2005 19:39:00 +1000, Zellan wrote:
>
>> Hi All,
>>
>> Have added a Strconv function to the AfterUpdate event of a field to
>> give
>> me
>> first letter capitalization (vbProperCase). I have added a msgbox
>> that
>> will
>> allow me to over-ride where necessary however it does not work.
>>
>> The code below will allow me to manually type in capitals into the
>> full
>> string when I hit the "Yes" button, but when I elect "No" the
>> vbProperCase
>> is not activated and no change is made. Can anyone please help me
>> with
>> my
>> code, I am teaching myself VBA very slowly and finding it a bit
>> frustrating
>>
>> Code as follows
>>
>> Private Sub Company_AfterUp date()
>> MsgBox "Override Capitalization" , vbYesNo
>> If "vbYesNo" = "No" Then
>> Company = StrConv(Company , vbProperCase)
>>
>> Else
>>
>> End If
>>
>> End Sub
>>
>> Regards
>>
>> Zellan
>
> You need to use the MsgBox() function.
> Also vbYesNo is a Number constant, so no quotes.
>
> If MsgBox("Overrid e Capitalization" , vbYesNo) = vbNo Then
> Company = StrConv(Company , vbProperCase)
> etc.
>
> --
> Fred
> Please only reply to this newsgroup.
> I do not reply to personal email.

I don't think you understood my reply.
Please post the entire event procedure.
--
Fred
Please only reply to this newsgroup.
I do not reply to personal email.

1) You have not correctly copied the code I gave you.
You moved the closing parenthesis.
You wrote:

If MsgBox("Overrid e Capitalization" , vbYesNo = vbNo) Then
etc.

vbYesNo has a value of 4.
vbNo has a value of 7
so your code equates to:
If MsgBox("Overrid e Capitalization" ,4 = 7) Then ....
which Access equates to:
If MsgBox(""Overri de Capitalization" ,False) Then
..... because 4 does not = 7.
False has a value of 0.
vbOKOnly has a value of 0.
That's why you only get just OK on the message box instead of Yes and
No.

Please change it to what I wrote.
I wrote:
If MsgBox("Overrid e Capitalization" , vbYesNo) = vbNo Then
Now you will get both buttons.

2) Even after you get both buttons, you haven't told Access what to do
if Yes is clicked.
How is Access supposed to know unless you tell it?

Below is how your code should look.
All you need do is add code to the Else portion to tell access what to
do if Yes is selected.

Private Sub Company_AfterUp date()
If MsgBox("Overrid e Capitalization" , vbYesNo) = vbNo Then
Company = StrConv(Company , vbProperCase)
Else
' Tell it what to do if Yes is clicked here
End If
End Sub
--
Fred
Please only reply to this newsgroup.
I do not reply to personal email.

Nov 13 '05 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
2074
by: peter | last post by:
Hello all, Recently I've started to refactor my code ...(I'm using python 2.3.4) I tried to add extra functionality to old functions non-intrusively. When I used a construct, which involves renaming functions etc... I came across some recursive problems. (a basic construct can be found under the section BASIC CODE) These problems do not occur when renaming objects. (see section EXTRA CODE)
14
2324
by: Jim Hubbard | last post by:
Are you up to speed on the difficulties in using the 1.1 .Net framework? Not if you are unaware of the 1,596 issues listed at KBAlertz (http://www.kbalertz.com/technology_3.aspx). If you are going to use .Net......I highly recommend signing up for the free KBAlertz newsletter at http://www.kbalertz.com/default.aspx. Looking at all of the errors and quirks sometimes makes me wonder if this thing is really ready for prime time.
19
3144
by: Jim | last post by:
I have spent the past few weeks designing a database for my company. The problem is I have started running into what I believe are stack overflow problems. There are two tab controls on the form (nested), three list views, one tree control with up to 30,000 nodes, maybe 15 comboboxes (half of which have a large recordset as rowsource), 20 or so buttons and around 30 text boxes (not to mention the images, labels, etc and around 1000 lines...
10
2416
by: BBFrost | last post by:
We just recently moved one of our major c# apps from VS Net 2002 to VS Net 2003. At first things were looking ok, now problems are starting to appear. So far ... (1) ComboBox.SelectedValue = db_value; If the db_value was not included in the ComboBox value list the ComboBox.SelectedIndex used to return -1, Now the very same code is
19
2987
by: Dales | last post by:
I have a custom control that builds what we refer to as "Formlets" around some content in a page. These are basically content "wrapper" sections that are tables that have a colored header and provide an open TD with a DIV in it for the content of this formlet. (The DIV is for DHTML to hide and show the content) I've created a web page showing step by step the two problems I'm encountering. This problem is much easier to see than it...
2
3182
by: Brian | last post by:
NOTE ALSO POSTED IN microsoft.public.dotnet.framework.aspnet.buildingcontrols I have solved most of my Server Control Collection property issues. I wrote an HTML page that describes all of the problems that I have encountered to date and the solutions (if any) that I found. http://users.adelphia.net/~brianpclab/ServerControlCollectionIssues.htm This page also has all of the source code in a compressed file that you are free to download...
0
1270
by: Peter R. Vermilye | last post by:
I am involved on a web application that is using a third party set of APIs for remote database access (middleware). I've been brought in because of my background in programming, thus I'm new to this web development process so forgive my ignorance. The third party has a shopping cart which must be saved in the session. When navigating from page to page we experience some odd behavior on the hosted server that we do not see on our...
18
2267
by: __PPS__ | last post by:
Hello, I'm a university student and I'm preparing for my final today. I'm reading course notes, I found completely strange piece of code. It makes me laugh, I think the teacher needs to prepare herself for this course. so I ask for your point of view. here's the piece of code: Memory management by client!! // Listing 9.4. Memory management by client rather than by server object
2
3276
by: Mike | last post by:
Hi, I am new to C and having problems with the following program. Basically I am trying to read some files, loading data structures into memory for latter searching. I am trying to use structres and arrays of pointers to them. I have gotten the program to compile with gcc on WinXP. If the file i read doesnt have alot of records, it runs thru. But once i add more, it dies. In this program i have 4 files setup to read. The
9
2415
by: =?Utf-8?B?SG93YXJkIFNtaXRo?= | last post by:
I am using VC++ 6.0 (with SP5 installed). When using WinXP this is with SP2 installed. I am developing an instrumentation system comprising a set of networked PCs connected using TCP/IP TCP links. Communications on the Windows PCs use a class derived from CAsyncSocket(). I have written client and server versions of my software for use on the appropriate PCs. I am also using communicating with a legacy DOS based system, with the software...
0
9568
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9398
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10156
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10007
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9951
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9832
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8831
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
3924
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2805
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.