Forms :: Changing Format Of Field Based On String Length
Jun 11, 2014
I have a continuous form that displays data from a table. What I am trying to accomplish is to change the format of the field if the string length is equal to 11, to "@@@-@@@-@@@@-@". Otherwise if it is greater or less than 11 then no format.
I have tried it using code:
If Len(Me.FormFieldName)=11 Then
Me.FormFieldName.Format = "@@@-@@@-@@@@-@"
End If
Is it even possible and if so is my syntax correct or am I way off base?
View Replies
ADVERTISEMENT
Feb 17, 2014
I wanted to assign the field "Number of magazine" with special format based on date/time format but showing only year and month in the format: "yyyy-mm".
So in property of this field in format I put yyyy-mm and in input mask I type 0000-00;;-
I also created the form based on the table containing above field and I defined format and input mask for corresponding formant in the same way like at the table.
But if I try to type date for example 2014-01 in text box of the form it comes up with the full date 2014-01-01. Why does it do like this? What do I do incorrectly?
View 2 Replies
View Related
Feb 6, 2006
I am trying to change a field lenght of a large database (access 97) It is at 50 right now and want to change it to 25. When I try to change it and save the table I get a error when the bar is about 3/4 the way accross the bottom.
Microsoft can't change the data type - there isn't enough disk space or memory.
then
not enough space on temporary disk
This is error 3183. In the help it says that the TEMP DOS enviroment variable location doesn't have enough space. (summerising). Now I have a 100+gb drive that isn't close to being full. I also changed the MaxLocksPerFile registry dword to 8,000,000 as my table has around over 3 million records. I have tried this on a xp and 2000 machine same results. Next I am going to try it on a 98 machine. I could do it by breaking up the table into 2 differnt ones and do each one individually but there is an autonumber field used as a reference number (I know I know). So that would screw up the numbering scheem (Yes I know there are ways arund that also). this database is about 400MB
Couple of questions
1. Is there a way around this? I have not found a solution on line yet.
2. Will lowering the field length make the database smaller (the data that is in there now is less than 25 charecters and the field is set to 50.) I have gotten mixed info on this. there are a few fields I would like to reduce.
Thanks
sam
View 2 Replies
View Related
Feb 16, 2014
I have a simple add form that will add an entry to one of two tables: Box 1-1, or Box 1-2.
They have the exact same fields. In the add form, I want the user to specify a Rack field and a Box field. Box 1-1 would be Rack 1, Box 1. Box 1-2 would be Rack 1, Box 2 (there will be more tables later, but just using two for now until I get it working).
But right now my form always adds to the table Box 1-1 - I can't get it to switch.
I've added the code I have so far below. The first part is what I'm having trouble with, the second part just uses a Submit button to add a new record - I'm just including it in case it's interfering in some way I'm not seeing. I'm running Access 2007.
Code:
Private Sub Switch_BeforeUpdate()
If Me.Rack.Value = "1" And Me.Box.Value = "1" Then
Form_Add.RecordSource = "Box 1-1"
ElseIf Me.Rack.Value = "1" And Me.Box.Value = "2" Then
Form_Add.RecordSource = "Box 1-2"
[Code] ...
View 7 Replies
View Related
Jul 12, 2007
I want to create an query that will update a field value for records where the length of the field value is less than a given number (if LEN of UniqueID is less than 6 for example), but I can't figure out how to write a SELECT query, much less an UPDATE query for this condition....can someone help me, please?
View 1 Replies
View Related
Jan 7, 2015
I'm having a spot of trouble trying to get conditional formatting to work. I have an overview form which displays current quotes going through the system, the QuoteStartTime field is generated from the Now() command.I Would like if possible to show, 1 hour = Green, 2 hours = Amber and 3+ hours Red.
I've tried variations of
hour([QuoteStart])>1
DateAdd("h",1,[QuoteStartTime])
I've done this before with a date only field before, but working with time is taking too much time.
View 1 Replies
View Related
Jul 5, 2005
Does anyone know how to change a field FORMAT default? I am creating lots of tables with lots of number format fields. I don't, however, want a zero default value (or any default value for that matter) for all of these fields. I can go in and delete them manually, but that seems like a backward way of doing things. Does anyone know how to elimate that default value from the format of a number field in general?
Thanks!
Carly
View 2 Replies
View Related
Aug 19, 2005
I have a fax number field iwhich has a mask. +(000)-00-000-000 in a table of many records.
The problem is that every record has a number in the first part of country code +(001)which must have come there by mistakes, few records have complete and true fax numbers.
I need a query that can Update this Fax_Number field where the length of the string is less than 7 digits.
Some thing like UPDATE Contacts SET Contacts.Fax_Number = ""
WHERE ((Len("Fax_Number")>"6"));
How can i do this. Thanks.
View 4 Replies
View Related
Oct 18, 2006
How can I extract a string and from a textbox and make out that it is x (here x can be any value, e.g. 15) characters long??
View 1 Replies
View Related
Dec 3, 2014
I am using an append query to move data into another database. One of the fields being imported is a date field in text form (20141201). I need it appear in the final database in text form (01/12/14) I have tried using several date conversions and cant get this work. Ideally i need the final value as a text rather than date.
View 8 Replies
View Related
Apr 22, 2015
I have a calculated field in a report, which is as follows:
=IIf(IsNull([POI_E1A]),(([TodaysDate]-[EADDate])/365)/3,[A1]+[T2]+[A3]+[T4]+[A5]+[T6]+[A7]+[A8])
The calculation works fine; however, I only want to show the whole number (not rounded up; not rounded down). In other words, if the result is 0.9967, then I want 0 to appear.
I cannot figure out how to make this happen. In the properties section I ensured the format was "general number" with 0 decimal places but this didn't change the result. I tried changing the format in the calculated field, again, I wasn't successful.
View 5 Replies
View Related
Jan 22, 2007
In a database that holds membership records, I have three years worth of info relating to membership dues paid. I want to extract who has not paid a membership fee for the last three years, so we can strike them off our records, i.e. I have members' personal details, but there are no records in the payments table, nothing has been entered because they just have not paid. Do I run a query looking for a zero length string? Just how do I achieve this? Have I done right in not entering anything?
Help appreciated!
View 2 Replies
View Related
Jan 26, 2007
I am using VBA code to export a small table as a .csv file, which is no problem, except that the customer insists that where a field is blank, the .csv file must contain a pair of double quotes.
In other words, I can produce this:
"Field1","Field2",,"Field4","Field5"
but they insist on this:
"Field1","Field2","","Field4","Field5"
In the table design, I have made the default for each field = "", but I still can't seem to force the double quotes into a blank field.
Any suggestions will be welcomed.
View 2 Replies
View Related
Aug 18, 2005
Hi
Is it possible to change the default table setting in Access 2000 for the 'Allow Zero Length' property from No to Yes? Or does anyone know any code that can be run to change any existing fields with Allow Zero Length = No to = Yes?
Any assistance would be much appreciated.
Thanks.
View 2 Replies
View Related
Nov 7, 2005
in my db, all fields that aren't required default to a zero-length string.
In some reports (like mailing labels) I want the rows that contain no information (like the second Address line) to "shrink". I set all my properties to "can shrink" etc., but of course it's not working, because the value of the "empty" fields is "" instead of Null.
Is there a way I can write an IIF statement that will set the value of the field to Null if it contains a zero-length string?
View 4 Replies
View Related
Jun 4, 2014
I have a small issue, but cannot solve it. I have a form with a textbox bound to a time(7) on a SQL server linked table.
Even if I put the format as "Short time 24h" or "hh:mm" it will always come out with seconds, nanoseconds, etc as soon as you change record. I would like to avoid using the "current" event to keep the "hh:mm" at any record change.
View 4 Replies
View Related
Aug 16, 2005
Heyo, thought I'd toss my line to see if anyone has had a corruption like this:
Today I went digging through some of my tables on a db I've been building and noted that most (but not all) of my text fields had Unicode Compression/Off and Zero-Length-Strings/Allowed. Now, I know for certain that I never touch Unicode Compression and zero-length strings are not my bag in this db so I went to toggle these and I recieved 'Access encountered an error when attempting to save' type error when I, you guessed it, attempted to save.
So I built fresh tables, and imported my data, and all seemed well but digging further through my database I have noted that ALL of my tables seem to be suffering from this in some way.
First off, does anyone know what has happened?
Secondly, does anyone have a guess as to why this happened?
Lastly does anyone have a suggestion on how to rectify this?
I'm not a huge fan of building this entire gigantic db from the ground up and I'll do it if I need to, but I'd prefer to figure out what went wrong before we get there and it happens again.
Many thanks,
~Chad
View 1 Replies
View Related
Mar 14, 2015
I have strings of names in a calculated field named [CurrentDelReverse] that are separated by spaces, but some strings have 2 names and some strings have 7 names.
They look like this:
tjcrane becca002
shiel001 donohue ekaler
jpohl jhalling jsleifer laerwin chan ekaler
I need to separate the names, but I only need the first two names in two separate fields.
I am able to capture the first name with no problem using:
Delegatee: Left([CurrentDelReverse],InStr([CurrentDelReverse]," "))
My problem is trying to grab the second name in the list to show in a new column.
I have tried so many different things and the closest I got to solving it was:
Delegator: Trim(Mid([CurrentDelReverse],InStr(1,[CurrentDelReverse]," ")+1,IIf(InStr(InStr(1,[CurrentDelReverse]," ")+1,[CurrentDelReverse]," ")=0,0,InStr(InStr(1,[CurrentDelReverse]," ")+1,[CurrentDelReverse]," ")-InStr(1,[CurrentDelReverse]," "))))
This returned the second name in the list but ONLY if it had more than two names in the string.
View 7 Replies
View Related
Sep 16, 2013
I have a table where I want to break longer strings into three-character strings.
So... for example the data item "Forest," I'd like to generate "FOR" "ORE" "RES" "EST" and write all four to another table, allowing for duplication. Alternately, we could make a list and just count the unique 3-character strings. The end goal here is to measure the frequency of 3-character strings across a set of data.
how to do this with an Access query?
View 1 Replies
View Related
Jul 28, 2014
I have a report that prints labels (similar to avery labels) which pulls data from a query. These labels are all unique and vary in length. Due to the length variance, I want the font size to get smaller for labels with more characters. I want the text to go down to another line when necessary.
In my report under the OnPage Event Procedure I wrote this:
Private Sub Report_Page()
If Len(Text2) > 20 Then Text2.FontSize = 8
If Len(Text2) > 10 And Len(Text2) < 21 Then Text2.FontSize = 10
If Len(Text2) < 11 Then Text2.FontSize = 14
End Sub
This works to some degree but the problem is that once there is a longer label, all of the proceeding labels are resized & the longer label that should have been resized was not.
Is there another place I should be writing this code? I looked under events for the textbox but there doesn't seem to be anything that would work since none of them would trigger when printing labels
View 3 Replies
View Related
May 2, 2014
Is there any way to force a field value to be unique and of a set length, but with exceptions?
Let me explain... I have a text field in my table called "employee_number" and this value is always one of the following:
NULL
an 8-digit number
the word "External"
What I want to do is to force that field to either be NULL, the word "External", or a unique 8-digit number.
Is this possible? Obviously I can't set the source field in SQL to accept unique values only but I wondered if there was any way around it at form level?
View 8 Replies
View Related
Dec 4, 2013
My form which is based on a table carrying same name doesn't append the full length of the text to one of the fields.
I don't know where the mistake is occurring or indeed I don't know if the error is in the table or in the form.
The form is showing full length of the text but when I look it in the table, it has just one or two bits of the full length.
View 4 Replies
View Related
Sep 10, 2013
How do I use a update sql query to update a field based on a string from an input box. Heres what i have been trying:
Code:
Dim NETWORKBOX As String
NETWORKBOX = InputBox("NETWORK TO IMPORT" & Chr(10) & "EXAMPLE: PRIMARY", "NETOWRK TYPE")
sql = "UPDATE " & TABLENAME & " SET NETWORK = " & NETWORKBOX & " ;"
DoCmd.RunSQL sql
If i run the code and input 'PRIMARY' in the NETWORKBOX the sql query will return an 'enter parameter value dialog box' with the word 'PRIMARY' above the input field.
View 1 Replies
View Related
Feb 22, 2006
Hi.
I have
Form with 3 list boxes.
1st LB populates 2nd etc.
The 3rd LB value chooses a field.
The Fieldname Table has field "Field Type"
I want to change the Text box next to the List box to this entry in the Db.
Ie. If I choose a field in the LB, say "Done?", then to update that field it needs to offer me a "yes/no" field type
Therefore it changes the TextBox to a Checkbox (or combo with Yes and No as options)
Any ideas?
View 2 Replies
View Related
Oct 18, 2014
I have a query that is based on Property & tenants. It runs a report that gives me all the property listed with the tenants & other info for the property's. Sometimes the tenant moves out & the property is Vacant, so i have a Vacant flag in the property table.
But when i run the query it prints out the last tenant. Can i pick up the vacant flag & change the tenant name to Vacant on the report? As i don't want to delete the tenant from the tenant table.
View 3 Replies
View Related
Jan 16, 2014
I import a CSV field which has not preserved the CR/LF when it was exported from BCM Remedy. There is no setting for that. The memo field prints on my report like this:
A custom solution would be developed, that once implemented, could become the standard product in similar situation. Normally would assign to Network Engineering, but will work with Ray and the IPT Team to cost out the solution and get approval to proceed. 2012/05/24 10:44:28 AM PCOLLINS Sent to Ray Massie for review to determine if a solution needs to be proposed, or if they can wait for the National IPT solution to be ready in 2013.
I want to add VBA code that inserts a CR/LF in the memo field before all but the first occurance of a string that looks like a date, the first occurance doesn't need it. I will do it right after I import the CSV file into the table, so it happens only once, and it always prints and displays the CR/LF.
The memo field is called "NBS Update" and the table is called "CCRR Remedy Data"Here is what I have, but don't actually know what to put in to find the date and add a CR/LF:
Code:
Dim db As DAO.Database
Code:
Dim db As DAO.Recordset
Dim srtSQL As String
[code]...
View 14 Replies
View Related