473,466 Members | 1,370 Online
Bytes | Software Development & Data Engineering Community
Create 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 1221
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*******@dodgeit.com> wrote in message
news:a6**************************@posting.google.c om...
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(ByVal varString As Variant) As Variant

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

If Not IsNull(varString) Then
For lngFor = 1 To Len(varString)
strChar = Mid(varString, lngFor, 1)
lngAsc = Asc(UCase(strChar))
If (lngAsc >= 65 And lngAsc <= 90) Or _
IsNumeric(strChar) 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*******@dodgeit.com> wrote in message
news:a6**************************@posting.google.c om...
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
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...
8
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...
2
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...
2
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...
4
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...
9
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...
8
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 ...
5
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...
2
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...
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
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,...
0
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...
1
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...
0
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

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.