473,654 Members | 3,129 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

I know this has got to be a simple formatting issue

I am having trouble getting one database to export data that another
one can import. The problem is a dash "-". I have a group of numbers
entered in my database that have a dash in them (e.g. "AB1-234567")
but the database that I am sending the data to cannot accept those
dashes and needs the input set accordingly (e.g. "AB1234567" ). Is
there a way to have a query or report not display those dashes? All
numbers are entered as 10 digits (counting the dash) and the dash is
always the 4th character. Alternatively, if it is easier to do it the
other way around, if the number was entered without the dash, is there
a way to make it appear to have the dash on reports and forms?

I am using Access XP (2002) but I expect the solution would be the
same for any version.
Nov 13 '05 #1
4 1226
The alternative (store the number without the dash) is easier, such as:

Format(.Fields( "off_ssn"), "###-##-####")
Format(.Fields( "off_phone" ), "(@@@) @@@-@@@@")

your numbers would be similar:

Format(.Fields( "my_data"), "@@@@-######")
Darryl Kerkeslager

"Brian Mink" <Br*******@dodg eit.com> wrote in message
news:a6******** *************** ***@posting.goo gle.com...
I am having trouble getting one database to export data that another
one can import. The problem is a dash "-". I have a group of numbers
entered in my database that have a dash in them (e.g. "AB1-234567")
but the database that I am sending the data to cannot accept those
dashes and needs the input set accordingly (e.g. "AB1234567" ). Is
there a way to have a query or report not display those dashes? All
numbers are entered as 10 digits (counting the dash) and the dash is
always the 4th character. Alternatively, if it is easier to do it the
other way around, if the number was entered without the dash, is there
a way to make it appear to have the dash on reports and forms?

I am using Access XP (2002) but I expect the solution would be the
same for any version.

Nov 13 '05 #2
Brian Mink wrote:
I am having trouble getting one database to export data that another
one can import. The problem is a dash "-". I have a group of numbers
entered in my database that have a dash in them (e.g. "AB1-234567")
but the database that I am sending the data to cannot accept those
dashes and needs the input set accordingly (e.g. "AB1234567" ). Is
there a way to have a query or report not display those dashes? All
numbers are entered as 10 digits (counting the dash) and the dash is
always the 4th character. Alternatively, if it is easier to do it the
other way around, if the number was entered without the dash, is there
a way to make it appear to have the dash on reports and forms?

I am using Access XP (2002) but I expect the solution would be the
same for any version.

There may be a function like Replace or somthing like that where you can
replace chars in a string with another value with your current version
of Access. Here is a simple routine to strip chars in a string (allows
a Null to be passed) that removes anything not an A-Z or 0-9 that I can
use in A97. You can drop this code in a Module.

Public Function StripChars(ByVa l varString As Variant) As Variant

Dim strChar As String
Dim lngFor As Long
Dim lngAsc As Long

If Not IsNull(varStrin g) Then
For lngFor = 1 To Len(varString)
strChar = Mid(varString, lngFor, 1)
lngAsc = Asc(UCase(strCh ar))
If (lngAsc >= 65 And lngAsc <= 90) Or _
IsNumeric(strCh ar) Then
StripChars = StripChars & strChar
End If
Next
End If

End Function
You can then create a column in your query. Something like
FieldNoDashes : StripChars([FieldWithDashes])
This will strip the field name FieldWithDashes (substitue your table
field name) that contains the dashes and return a value with no dashes.
Nov 13 '05 #3
Thanks so much for sending that! It worked perfectly! Did you write it
just for me or did you have a similar module that you customized?
Either way, I appreciate it. This database started out as a small
project but has grown over the years. I did almost all of it using
Access tools, with only one module. It looks like it is time to learn
VBA.

Thanks again,

Brian

There may be a function like Replace or somthing like that where you can
replace chars in a string with another value with your current version
of Access. Here is a simple routine to strip chars in a string (allows
a Null to be passed) that removes anything not an A-Z or 0-9 that I can
use in A97. You can drop this code in a Module.

Nov 13 '05 #4
Brian,
Start with the simple: are the columns in both source & destination
databases the same datatype and size? Second, are you trying to import text
into a numeric column? Assuming both columns are text and both are the same
size and they are big enough, the dash should not be an issue.

"Brian Mink" <Br*******@dodg eit.com> wrote in message
news:a6******** *************** ***@posting.goo gle.com...
I am having trouble getting one database to export data that another
one can import. The problem is a dash "-". I have a group of numbers
entered in my database that have a dash in them (e.g. "AB1-234567")
but the database that I am sending the data to cannot accept those
dashes and needs the input set accordingly (e.g. "AB1234567" ). Is
there a way to have a query or report not display those dashes? All
numbers are entered as 10 digits (counting the dash) and the dash is
always the 4th character. Alternatively, if it is easier to do it the
other way around, if the number was entered without the dash, is there
a way to make it appear to have the dash on reports and forms?

I am using Access XP (2002) but I expect the solution would be the
same for any version.

Nov 13 '05 #5

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

Similar topics

6
1813
by: Lindy | last post by:
I'm using VB .Net and am brand new to XML. I need to create an XML file with the following lines: <?xml version="1.0" encoding="UTF-8" ?> - <HC_DATA xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://.../asc.xsd"> other stuff... </HC_DATA>
8
12040
by: Dimitri Furman | last post by:
Given: Access 2002/2003 A subform in datasheet or continuous view, placed on a tab page (this last may or may not matter) Conditional formatting applied to some controls on the subform - format expressions are the same for all controls Under some undetermined circumstances, when such subform is displayed, the controls on the subform start to visibly flicker, the cursor in the subform stops blinking, and CPU utilization goes to 100%....
2
1606
by: Alan | last post by:
I have a database I created on a network share when I print a report from my computer the printed copy contains the colors specified in conditional formatting but if I go to another computer on the network the report prints greyscale. If I change conditional formatting to bold and italic it will work fine but not colors. This is a mix of win2k and XP machines and a mix of access 2000 and 2002
2
1190
by: Sara | last post by:
The problem: Conditional formatting bold, red when field Value < date() sets the field background to white - always - whether condition is met or not. I want the field unfilled and just red/bold when the date has passed. Background: I have 2 related fields that are only rarely active, so I manage them in the query for the subform: ShowBlanket: IIf(,"Blanket","") and
4
2707
by: deko | last post by:
I've heard it's best not to have any formatting specified for Table fields (except perhaps Currency), and instead set the formatting in the Form or Report. But what about Yes/No fields? When I create a Yes/No field in a Table the default format is "Yes/No". If I clear or change the Format property in the General Tab (and keep the default "Checkbox" in the Lookup tab), the field still looks the same when I open the table in Datasheet...
9
3202
by: sck10 | last post by:
Hello, I have a page with an ImageButton that is used to redirect to another page. When the page first opens, everything looks as expected. However, when I click on the image, the new page opens as expected. However, when I go back to the original page, all the font sizes are larger. Its as if by clicking on the ImageButton, my CSS formatting was discarded. When I look at the source for the following code, this is what I get:
8
1774
by: gopal | last post by:
Hi I am trying to write to log file but the formatting of string is not properly aligned in log file result The results looks some thing like this OK move.xml Successful OK AppUser_ifrUsers.asp Successful
5
3059
by: CarrieR | last post by:
I am working within a DB I have been devolping in Access 2003, and have encountered a report coding issue I was hoping someone could help me with: I have 18 reports, each running off some smaller queried version of 2 main queries (apx. 6000 records each). The purposes of the DB and the reports require the formatting of these reports to change monthly as Actual Revenue is reported. I can accomplish all of these monthly formatting changes...
2
2081
by: =?Utf-8?B?VG9jbw==?= | last post by:
Hello. My goal is to pain the entire row fore color as Red. If the value of column 24 is true (boolean), I wish to paint the row as Red. Otherwise, leave row as default (no formatting). The Datagridview datasource is a datatable. Currently my issue is that all records are painted red on the Cell_Formatting event. But not all records meet the filter condition. Any ideas why? Here is code snippet private void...
0
8372
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
8285
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
8814
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
8706
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
8475
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
8591
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...
1
6160
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4293
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
1592
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.