[AccessD] program update & capitalization of fields

Heenan, Lambert Lambert.Heenan at chartisinsurance.com
Thu Jan 7 08:42:45 CST 2010


On reflection, the use of Ucase in the form should be in the form's BeforeUpdate and BeforeInsert events.

Lambert 

-----Original Message-----
From: accessd-bounces at databaseadvisors.com [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Heenan, Lambert
Sent: Thursday, January 07, 2010 8:42 AM
To: 'Access Developers discussion and problem solving'
Subject: Re: [AccessD] program update & capitalization of fields

Re 1/

This does seem to be a nice new bug in Access 2007. In previous versions the use of ">" in the format property of a field does what you expect: the text is *displayed* as all caps in the table, forms, queries, and report, though the actual data stored is still whatever happens to be typed. I just tested this in Access 2002 to be sure.

It seems that the code meisters in Redmond have dropped a ball win v 2007.

However, it is easy enough to work around this. If you want to actually store the data as all caps then (assuming you are using a bound form) you could just add a line of code to the LostFocus and/or Exit events of the text box where the data is entered:

txtSomeTextBox = Ucase(txtSomeTextBox)

Alternatively, base your report on a query which does the same thing when the query is run...

Select Ucase(SomeField) as MyTextFiled...

Regarding 2/ 

It sounds like the process needs the record to be saved before continuing. So instead of leaving the record and returning to it, just put this line at the start of the sub that runs when the button is clicked...

Me.Dirty = False

That line results in the data being saved.

Lambert

-----Original Message-----
From: accessd-bounces at databaseadvisors.com [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of John Clark
Sent: Wednesday, January 06, 2010 10:37 PM
To: accessd at databaseadvisors.com
Subject: [AccessD] program update & capitalization of fields

OK, I've presented the DA Vouchers program I was writing...thanks, as usual, to many list members for getting me through some snags and road blocks. Funny thing happened...I had to hurry, and come in during my vacation, because they were to go live on Jan 4th...but apparently nobody checked the law for this, and it reads that vouchers must be issued from the court. So, we're in a holding pattern, until this gets ironed out...good thing too, because I had a few bugs to work through...suits me right, for rushing through this thing and not testing properly.

I got most of these ironed out, but there are a few that are nagging me. And, I attacked the "hard ones" first, thinking I'd knock these off and then coast to the finish...this is how I like to do things. Yeah, right...I got the "hard ones" complete, and I'm stuck on the "easy ones."

I think my biggest holdups now are...there are 2:

(1) Capitalization! I've never had a problem w/this, but apparently things must work different in 2007. I've used the format ">" to turn the field input to caps, and it works visually on the form, and in the table itself. However, when I run the report...creating the voucher...it prints each field as I typed it. In my tests, if I type in LC, it shows on the form in LC, if I do in sentence case or title case, it shows that way...and Caps, if it was typed that way. This doesn't make sense to me...at all...if it shows on the form and in the table, in caps, then I figured it would show in the report that way.

I found some code, "KeyAscii = Asc(UCase(Chr(KeyAscii)))" that I place in the 'KeyPress' event, and that does seem to work, but do I really need to do this for each and every field? Thankfully, I don't have many fields...only 7 text fields...but I'm also thinking of future projects. 

(2) Another problem I am having, is that I am getting "Invalid use of Null" when I click the button to create the voucher. However, if I leave that record and return...in either direction...it works fine.

In a nutshell, I type the date first, when I leave that field the mileage rate is filled in from a query. The next field is actually the auto created voucher number, which was my biggest problem actually, until now...I am going to take away this tab stop. It then goes to Last name, First name, address, city, state, and zip, of the witness...the recipient of the voucher...these are the fields I want capitalized. Then the user must type in the first and last name of the defendant, and choose the proper budget code, from a drop-down box. The finial four fields are for miles traveled, rate, fee, and amt owed...only miles traveled is filled out at this point...rate came upon the user typing the date, fee is a default value, and amt owed is calculated after you enter the miles traveled. 

At this point, one should be able to click the button to "create voucher" but it gives the error here. It did not do this, when I first wrote it, and it appeared from the time I worked on it, to delivery...it never erred on me at home.

I'm thinking that I need to run a requery or something...what do you think?

Hopefully somebody can help me

Thanks

John W Clark


--
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com

--
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com




More information about the AccessD mailing list