473,386 Members | 1,820 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

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_AfterUpdate()
MsgBox "Override Capitalization", vbYesNo
If "vbYesNo" = "No" Then
Company = StrConv(Company, vbProperCase)

Else

End If

End Sub

Regards

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

Private Sub Company_AfterUpdate()
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_AfterUpdate()
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("Override 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******@example.invalid> wrote in message
news:6t****************************@40tude.net...
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_AfterUpdate()
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("Override 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*********@baeAWAYWITHITsystems.com> wrote in message
news:42**********@glkas0286.greenlnk.net...
"Zellan" <Ze****@hotmail.com> wrote in message
news:42***********************@news.optusnet.com.a u...

Private Sub Company_AfterUpdate()
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******@example.invalid> wrote in message
news:6t****************************@40tude.net...
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_AfterUpdate()
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("Override 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_AfterUpdate()
If MsgBox("Override Capitalization", vbYesNo = vbNo) Then
Company = StrConv(Company, vbProperCase)

Else

End If

End Sub

Regards and thanks for your help Fred

Zellan

"fredg" <fg******@example.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******@example.invalid> wrote in message
news:6t****************************@40tude.net...
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_AfterUpdate()
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("Override 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_AfterUpdate()
If MsgBox("Override Capitalization", vbYesNo = vbNo) Then
Company = StrConv(Company, vbProperCase)

Else

End If

End Sub

Regards and thanks for your help Fred

Zellan

"fredg" <fg******@example.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******@example.invalid> wrote in message
news:6t****************************@40tude.net...
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_AfterUpdate()
> 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("Override 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("Override Capitalization", vbYesNo = vbNo) Then
etc.

vbYesNo has a value of 4.
vbNo has a value of 7
so your code equates to:
If MsgBox("Override Capitalization",4 = 7) Then ....
which Access equates to:
If MsgBox(""Override 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("Override 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_AfterUpdate()
If MsgBox("Override 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******@example.invalid> wrote in message
news:m0*****************************@40tude.net...
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_AfterUpdate()
If MsgBox("Override Capitalization", vbYesNo = vbNo) Then
Company = StrConv(Company, vbProperCase)

Else

End If

End Sub

Regards and thanks for your help Fred

Zellan

"fredg" <fg******@example.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******@example.invalid> wrote in message
news:6t****************************@40tude.net...
> 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_AfterUpdate()
>> 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("Override 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("Override Capitalization", vbYesNo = vbNo) Then
etc.

vbYesNo has a value of 4.
vbNo has a value of 7
so your code equates to:
If MsgBox("Override Capitalization",4 = 7) Then ....
which Access equates to:
If MsgBox(""Override 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("Override 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_AfterUpdate()
If MsgBox("Override 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
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...
14
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...
19
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...
10
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) ...
19
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...
2
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...
0
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...
18
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...
2
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...
9
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....
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...

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.