Modules & VBA :: Changing From Integer To Text

Nov 23, 2014

I am having a query which having a category field like Electrical, Sports, House hold etc.

What I want that if i select Electrical then it should return 15, if Sports then 10 and so on i think this could be done through this below mentioned VBA but it need change from integer to text...

Option Compare Database

Public Function fncGrade(intNum%) As String
Select Case intNum
Case 0 To 1: fncGrade = "Same as Previous"
Case 2 To 32: fncGrade = "C-3"
Case 33 To 40: fncGrade = "C-2"
Case 41 To 50: fncGrade = "C-1"
Case 51 To 60: fncGrade = "B-3"
Case 61 To 70: fncGrade = "B-2"
Case 71 To 80: fncGrade = "B-1"
Case 81 To 90: fncGrade = "A-2"
Case 91 To 100: fncGrade = "A-1"
Case Else:: fncGrade = "X-X"
End Select
End Function

View Replies


ADVERTISEMENT

Changing An Integer To A Month

Oct 18, 2006

I have a form that asks what month you completed a file (04, is april ect.). From this form a report is opened, in my report, I have it read this number and I want to display the month for the number thats entered (if they enter 04 I want april displayed on the report). There is already a ton of data that has the MonthCompleted as 04, so changing that is out of the question.

Thanks, JOe K.

View 3 Replies View Related

Help - SQL Lookups (Text Or Integer)

Apr 27, 2006

Hi Guys,

First off, a big thanks to everyone on the site. I have learnt a lot since first discovering this site a few weeks back.

Problem:

Having understood that it is better to create SQL lookups to queries of tables rather than to the tables directly, I am having trouble understanding what value I should store in my main table, a text value or the ID (number) (of the text value.)

I have an asset table with a field Equipment Type. This field looks at a query of the EquipmentType Table.

Would it better to store the text value "Printer" in the main asset table (in which case I can query the table directly but the field will use up more space (i.e. 25 char)?)

or

Store the Equipment_Type_ID "1" relating to the Printer (will use up less space, but mean any queries querying the actual name would have to include the EquipmentType table).

Any advise would be much appreciated.

:confused: My thought was that I should go with the ID as otherwise I will be storing duplicate data. If this is the case, when would a text value be more suitable.

View 1 Replies View Related

Modules & VBA :: Changing To A Record Based On Text Box Entry

Sep 16, 2013

i have a database with a large number of records. Navigating through the records through a form one by one is a pain, so i want to create a text box where you can enter the ID number of the record, and whichever record has the matching ID number it changes to that specific record. I know that something like this is already apparent at the bottom of Access, but i want my user to do everything within the database itself, as all of the panes are removed whilst being used

View 11 Replies View Related

Modules & VBA :: Changing Combobox Text Based On Listbox Selection

Jul 26, 2013

I have a listbox with several options.

When the user selects one of these items, i want a combo box's text to be changed to the selected item in the list box.

The listbox is named : D_OutputLsb
The combobox is named : D_ComponentNameCmb

View 4 Replies View Related

Converting Text Dates To Integer With Nulls Present?

Mar 18, 2013

I have a text field like, 11242010, and I need to be able to convert it into 3 int fields, day, month, year. I am trying to do this in a query and have create the following three;

DateD: IIf([DATE] Is Not Null,(CInt(Left(Right([DATE],6),2))))
DateM: IIf([DATE] Is Not Null,(CInt(Left([DATE],2))))
DateY: IIf([DATE] Is Not Null,(CInt(Right([DATE],4))))
Time: IIf([TIME] Is Not Null,[TIME])

When I have a value of Null, i keep getting #Error, I think when it's null.

View 7 Replies View Related

Tables :: Access Integer Field To Text Keeping Relationships

Mar 12, 2013

I have a database that was built 5 years ago that has an auto field with an integer. There are relationships attached to this. I an rewriting it to simplify the database and I need to keep the relationships somehow. I want to make the auto field a text fields. How to work this out...

View 3 Replies View Related

Convert A Text String To Integer - Check For Error In Expression Builder

Apr 24, 2013

I would like to convert a text string to integer.

Lots of posts say to use val, but it is not listed in access 2010

So I am trying,

Creating a field that is numeric then just referring to the string field.

This works good except where it finds actual text. It puts the value "#Type!" in there.

Would there be some kind of function to check for an error or check if the value is text.

View 1 Replies View Related

Modules & VBA :: Return Integer Based On Time?

Oct 30, 2013

I have a query with a Start Time where the need to return a set integer in another field in my query. I am attempting to get this to work in my StripSecondsQry.

I am not getting any error messages and I am not getting any output, When I view this in the Locals window I can see that it should be returning 7, but instead I get nothing unless I change it to

Code:
Function SortStart(StartTime As String) As Integer

then I get zero.

I had this working within the query, but I had to add one more time and then received a message that the expression was too complex.

Code:
Sort_Start: IIf([StartTime]="7:00 AM",1,IIf([StartTime]="8:00 AM",2,IIf([StartTime]="8:45 AM",3,IIf([StartTime]="9:00 AM",4,IIf([StartTime]="9:15 AM",5,IIf([StartTime]="10:00 AM",6,IIf([StartTime]="10:15 AM",7,IIf([StartTime]="10:30 AM",8,IIf([StartTime]="12:00 PM",9,IIf([StartTime]="1:30 PM",10,IIf([StartTime]="1:45 PM",11,IIf([StartTime]="2:00 PM",12,IIf([StartTime]="3:00 PM",13,IIf([StartTime]="4:00 PM",14))))))))))))))

View 3 Replies View Related

Modules & VBA :: SQL CAST Function - Return Integer Value Of String

Aug 28, 2013

Need to use CAST to return integer value of string (digits as data type string).

Where clause looks like this:

... Where Cast([Price File] as int) > 0

works fine in SQL Server but not sure what syntax is in VBA . Using Paul Baldy's suggestion to set Select statement as string and do the debug.print to verify that SQL has no goofs ... looks good but not to Access. What is proper syntax?

View 12 Replies View Related

Modules & VBA :: Count Total Number Of Integer In A List

Oct 7, 2013

In one table, I have a few fields. One of the field is "ItemSequence" and another one is "TotalPcs"."ItemSequence" is where user key in the sequence number for one or more item. 5 example for possible content of "ItemSequence" is as following :

1) 7
2) 4,6,9
3) 5-9
4) 3,5,9, 23-25
5) 3-5, 8-10

"TotalPcs" is the total number of items key in to "ItemSequence". For the 5 example above, the related "TotalPcs" should be as following:

1) 1 (1 item, which is item 7 alone)
2) 3 (3 item which is item 4, 6 and 9)
3) 5 (5 item which is item 5, 6, 7, 8 and 9)
4) 6 (6 item which is item 3, 5, 9, 23, 24 and 25 )
5) 6 (6 item, which is item 3, 4, 5, 8, 9 and 10)

For time being, the user have to count manually to get the "TotalPcs". I wonder is there a way to calculate the "TotalPcs" by programming?

View 7 Replies View Related

Modules & VBA :: Calculate Integer Number Difference From Two Dates

Sep 20, 2014

Basically, I am trying to calculate a integer number difference from two dates (TAT = Due-Date - Result_Date). The number is calculated and excludes weekends and ideally holidays (for that I have a tblHoliday but not sure how to use it). The function below seems to calculate a number but doesn't exclude weekends.

For example, if Due_Date is 9/26/2014 and Result_Date is 9/30/2014, then TAT is calculated to be 5 (should be 2).Since 9/26/2014 is a Friday only Friday and Monday are used in the calculation.

Code:

Option Compare Database
Public Function WorkingDays(StartDate As Date, EndDate As Date) As Long
Dim intCount As Long
intCount = 0

[code]...

View 1 Replies View Related

Changing Date To Text

Jun 30, 2005

I have searched and found references to converting text to dates. I need to go the other way. I have client# field and a date field. I would like to make an update query to populate a new field by concatenating the two fields minus the "/". I am making a new key field in an existing table. Then in the future when data entry is done, I would like to convert the date and client# as they are entered. I was looking at using the left$ or right$ function, but the dates may be in mm/dd/yyyy format or m/dd/yyyy format or m/d/yyyy and so on, depending on the month and day. Is there an easy way to convert the date to a number? I tried datevalue, but it leaves the "/" in there. I'm not sure how to section off the parts of the date I need, when the month and day vary between 1 and 2 digits. Thanks for any help.

View 6 Replies View Related

Changing A Text Value In An Expr:

Nov 27, 2007

Hello all,

I'm using M$ Access 2002. I have a query which contains an expr as one of the fields. The expression adds three text fields together to create a salutation. This is the expression:

Expr1: [students].[Fname] & " " & [students].[LNAME] & " " & [students].[gradelvl]

Where all three fields are of the Text data type. I am trying to display the students grades for next year. So if the value of [students].[gradelvl] is "10", it should display "11". If it were a Number data type I think this would be easier for me to figure out.

Any ideas?

Thanks for your help,
cheers maX

View 2 Replies View Related

Changing The Color Of A Text Box

Dec 21, 2004

This is very close to the label question that I also have posted. I am trying to get my report to have the back ground of some text boxes turn yellow if they are populated. I can get them to turn yellow, but they turn yellow whether they are populated or not. I have the code in the Report Open event. Here is some of the code that I have.

If Not IsNull(MMSJob) Then
MMSJob.BackColor = 65535
Else
MMSJob.BackColor = vbWhite
End If

Can anyone help me?

learnasugo

View 7 Replies View Related

Changing Code Via Text Box

Nov 25, 2005

Hello,
in my Access database there is quite a bit of VBA code.
I have set my LAN and file path in some of this code but will need to change it when this database will get to other users using a different LAN and path.

Is there a way I can avoid them to open the code and manually change this information?
I was thinking of some sort of text box where they will write their path (ex. \S01000sharedoffice*.*) and use a cmdbutton to overwrite the existing path?

Thanks.

View 2 Replies View Related

Changing Vertical Text On A Report

Oct 2, 2005

Not sure if this is possible but I have a few text boxes on a report set to vertical yes under properties. They print fine, but on the pre-printed forms I'm using they print upside down. Is there a way to realign they way the text prints when using the vertical yes setting? I really need they text to be inverted. I'm I asking an impossible question? Thanks..

View 1 Replies View Related

Changing Case In Text Fields

Sep 1, 2006

Hi

Is there a way of changing the case of text that has been entered in a table?

Want a form to display capitalised names, say, no matter how they were entered. Know that they can be displayed in all caps using >.

Thanks

View 6 Replies View Related

Changing Rowsource In A Combo Box Depending On The Text In Another

Jul 10, 2007

Hi all,
I am trying to have the rowsource change on a "subcategory" combo box depending on what the "category" combo box says.

I added an event procedure to the "Category" combo box which changes the Row Source in the subcategory combo box to something else. I'm not sure that I did this right as if I close the database and reopen it, what I selected in the subcategory combobox is gone and it is blank. Any ideas? Here is my simple, likely incorrect event procedure:

Private Sub Category_Change()

If Category.Text = "Rare Books" Then
SubCat.RowSource = "scRareBooks"

End If

If Category.Text = "Legal Documents" Then
SubCat.RowSource = "scLegalDocuments"

End If


End Sub

Thanks!

View 5 Replies View Related

Help In Changing Number Value To Text On Report Of Combo Box....

Feb 15, 2008

I am using a combo box to enter Employees names for training hours...I want to use a pivotchart but when i use the training hours table/form the pivotchart gives me the combo box numbers instead of the names. I know there is a formula or something I am suppose to use here or even a query but I don't have a clue as to how to do this....if someone would be so kind in directing me with instructions and help...thanks
:confused:

View 4 Replies View Related

Changing Text In Queries Based On Date

Dec 9, 2006

Hiya All

Hope you can help me here


I need help with an update query that will change records for me based on the date

In the record I have a TEXT record called [GI1] that can have a multitude of data in it.
The data can be “EVA”, “CON 10/12/06”, “REQ 10/12/06”, “PAS 10/12/06”, or “B 10/12/06”, and finally “A 10/12/06”

What I need is a query will look at the Data that starts with “B” and change the letter to “A” if the date in the record has passed. {The Date can be any date in any year }

Many Thanks for Looking

Paul

View 2 Replies View Related

Changing Text Colour Of Labels On Activate

Nov 23, 2005

Hi, im working on my school project for A2.

When the user clicks on say; the customer ID dropdown menu, i want the label text on the right of it to get darker (make it more visible). How can i do this?

(i have attached a picture of my form)

thanks, Robin

View 2 Replies View Related

Changing Command Button Text Colour.

Jun 30, 2006

Hi all,

I'd like to change the colour of the text in a command button when the user click the button, but for the text to return to it's original colour when the botton pops back up.

I'm assuming you use the following commands:


Private Sub cmdClose_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
*******CODE********
End Sub

Private Sub cmdClose_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
*******CODE********
End Sub


But I'm not sure as to how I would enter the correct code.

Any help would be appreciated,

Best Regards,

Aaron

View 2 Replies View Related

Changing Color On Multiple Text Boxes

Jan 18, 2005

I have about 25 text boxes on my form that use the dcount or count functions to obtain a number. (Text boxes are labeled 'Text1' through 'Text25')
When the value of the textbox is 0, I would like to have the color of the text box turn red.

Is there a way I can do this using a for loop? Or a with statement?

Checking each one individually just seems like poor programming.
Any thoughts? Ideas?
Thank you.

View 2 Replies View Related

Queries :: Changing Text To Hyperlink In Query

May 7, 2014

I was trying to see if there is a way to convert text to a hyperlink in a query.

Background : I'm pulling information from a lotus notes database using an OBDC connection and storing it into an access database and using that to upload to a sharepoint site. While we are converting over to a sharepoint site, I was trying to make it easy to get back to the original site for each document to check the work.

One of my columns in the query looks like this:

Code:
Notes Link: "notes://pncpgha66/852570CE0056FEF3/0BFCC83A5C11D7C3852576CD0072ED3E/" & [NoteUNID]

I don't see a way to convert that whole part to a hyperlink though. Like I could with a date and text. Cdate().

View 1 Replies View Related

General :: Changing Text So That First Letter Is Uppercase

Nov 24, 2012

I want to change text in txt boxes. when a new customer is being created we are too lazy to put uppercase in. so i want to change the text so the first letter is uppercase. i have used this on every event and it doesn't change a thing.

PHP Code:

Private Sub txtTown_AfterUpdate()LResult = StrConv("TECH ON THE NET", 3)End Sub
Private Sub txtPostcode_AfterUpdate()LResult = StrConv([txtPostcode], 1)End Sub
Private Sub txtStreet_AfterUpdate()LResult = StrConv([txtStreet], 3)End Sub
Private Sub txtFirstName_BeforeUpdate()LResult = StrConv([txtFirstName], 3)End Sub 

I have this at the top

PHP Code : Option Compare DatabaseOption ExplicitDim LResult As StringDim LResponse As Integer 

View 6 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved