473,398 Members | 2,335 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,398 software developers and data experts.

making virtual fields along with real fields in select statement

hi all,

i have the following fields....

Document_Name, Document_No, Document_Date, Order_No, Order_Date,
Peripheral

The first 5 you can understand, peripheral is a memo field which
contains all less important (but important!) details like Address1,
Address2, Place_Of_Delivery in a comma delimited string such as:

Address1:Princess Street;Address2:Mumbai;Place_Of_Delivery:Bhiwandi;

I have already done something like this

select document_no, document_date, order_no, order_date,
getperipheral(Place_Of_Delivery) as Delivery_Place from mastertable

then getperipheral(Place_Of_Delivery) i replace with mid(peripheral,
instr(peripheral, 'Place_Of_Delivery') + 17, instr(instr(peripheral,
'Place_Of_Delivery'), peripheral, ';') - instr(peripheral,
'Place_Of_Delivery') - 17)

so i sql looks like

select document_no, document_date, order_no, order_date,
getperipheral(Place_Of_Delivery) i replace with mid(peripheral,
instr(peripheral, 'Place_Of_Delivery') + 17, instr(instr(peripheral,
'Place_Of_Delivery'), peripheral, ';') - instr(peripheral,
'Place_Of_Delivery') - 17) as Delivery_Place from mastertable

This method also works fortunately but there is only one huge
problem....

if place of delivery is not there at all.... and peripheral field is
blank.....then the ENTIRE RECORD DOES NOT SHOW UP OR THERE IS AN
ERROR.......is there any inbuilt function in access that can do
this.....this is a night mare.......

thanks,
shripal dalal.

Jan 17 '06 #1
3 1977
shripaldalal wrote:
hi all,

i have the following fields....

Document_Name, Document_No, Document_Date, Order_No, Order_Date,
Peripheral

The first 5 you can understand, peripheral is a memo field which
contains all less important (but important!) details like Address1,
Address2, Place_Of_Delivery in a comma delimited string such as:

Address1:Princess Street;Address2:Mumbai;Place_Of_Delivery:Bhiwandi;

I have already done something like this

select document_no, document_date, order_no, order_date,
getperipheral(Place_Of_Delivery) as Delivery_Place from mastertable

then getperipheral(Place_Of_Delivery) i replace with mid(peripheral,
instr(peripheral, 'Place_Of_Delivery') + 17, instr(instr(peripheral,
'Place_Of_Delivery'), peripheral, ';') - instr(peripheral,
'Place_Of_Delivery') - 17)

so i sql looks like

select document_no, document_date, order_no, order_date,
getperipheral(Place_Of_Delivery) i replace with mid(peripheral,
instr(peripheral, 'Place_Of_Delivery') + 17, instr(instr(peripheral,
'Place_Of_Delivery'), peripheral, ';') - instr(peripheral,
'Place_Of_Delivery') - 17) as Delivery_Place from mastertable

This method also works fortunately but there is only one huge
problem....

if place of delivery is not there at all.... and peripheral field is
blank.....then the ENTIRE RECORD DOES NOT SHOW UP OR THERE IS AN
ERROR.......is there any inbuilt function in access that can do
this.....this is a night mare.......

thanks,
shripal dalal.

On something like this I'd create a function. Something similar to the
following function. Insert this in a module and test.

Public Function GetAddressData(strAddr, strType) As String
Dim intPos As Integer
Dim strData As String

If Not Isnull(strAddr) then
'see if that section of address exists. If so, get
'the beginning of the end of the word
intPos = InStr(strAddr, strType)

'get start of the field data if found
If intPos > 0 Then strData = Mid(strAddr, _
intPos + Len(strType) + 1)

'if strData is empty, then no data for that field
If strData > "" Then
'look for field terminating ";" character
intPos = InStr(strData, ";")

If intPos > 0 Then
GetAddressData = Left(strData, intPos - 1)
Else
'field was not terminated at end with a ;
GetAddressData = strData
End If
End If
endif
End Function

Now you can create columns in the query using the following. If I
understood correctly, Peripheral is the memo field name
Address1:GetAddressData([Peripheral],"Address1")
Address2:GetAddressData([Peripheral],"Address2")
Place_Of_Delivery:GetAddressData([Peripheral],"Place_Of_Delivery")

This parses out the 3 fields.
Jan 17 '06 #2
Hi,

I am using ASP as my front end.... Where can i put this function ?
within access or asp ? if i put it in asp then will it run in the sql ?
or where can i put it in access that it will run when i call an sql
from asp... ? something like this:

select document_name, address1:getaddressdata([peripheral], "address1")
from mytable

regards,
shripal.

salad wrote:
shripaldalal wrote:
hi all,

i have the following fields....

Document_Name, Document_No, Document_Date, Order_No, Order_Date,
Peripheral

The first 5 you can understand, peripheral is a memo field which
contains all less important (but important!) details like Address1,
Address2, Place_Of_Delivery in a comma delimited string such as:

Address1:Princess Street;Address2:Mumbai;Place_Of_Delivery:Bhiwandi;

I have already done something like this

select document_no, document_date, order_no, order_date,
getperipheral(Place_Of_Delivery) as Delivery_Place from mastertable

then getperipheral(Place_Of_Delivery) i replace with mid(peripheral,
instr(peripheral, 'Place_Of_Delivery') + 17, instr(instr(peripheral,
'Place_Of_Delivery'), peripheral, ';') - instr(peripheral,
'Place_Of_Delivery') - 17)

so i sql looks like

select document_no, document_date, order_no, order_date,
getperipheral(Place_Of_Delivery) i replace with mid(peripheral,
instr(peripheral, 'Place_Of_Delivery') + 17, instr(instr(peripheral,
'Place_Of_Delivery'), peripheral, ';') - instr(peripheral,
'Place_Of_Delivery') - 17) as Delivery_Place from mastertable

This method also works fortunately but there is only one huge
problem....

if place of delivery is not there at all.... and peripheral field is
blank.....then the ENTIRE RECORD DOES NOT SHOW UP OR THERE IS AN
ERROR.......is there any inbuilt function in access that can do
this.....this is a night mare.......

thanks,
shripal dalal.

On something like this I'd create a function. Something similar to the
following function. Insert this in a module and test.

Public Function GetAddressData(strAddr, strType) As String
Dim intPos As Integer
Dim strData As String

If Not Isnull(strAddr) then
'see if that section of address exists. If so, get
'the beginning of the end of the word
intPos = InStr(strAddr, strType)

'get start of the field data if found
If intPos > 0 Then strData = Mid(strAddr, _
intPos + Len(strType) + 1)

'if strData is empty, then no data for that field
If strData > "" Then
'look for field terminating ";" character
intPos = InStr(strData, ";")

If intPos > 0 Then
GetAddressData = Left(strData, intPos - 1)
Else
'field was not terminated at end with a ;
GetAddressData = strData
End If
End If
endif
End Function

Now you can create columns in the query using the following. If I
understood correctly, Peripheral is the memo field name
Address1:GetAddressData([Peripheral],"Address1")
Address2:GetAddressData([Peripheral],"Address2")
Place_Of_Delivery:GetAddressData([Peripheral],"Place_Of_Delivery")

This parses out the 3 fields.


Jan 19 '06 #3
shripaldalal wrote:
Hi,

I am using ASP as my front end.... Where can i put this function ?
within access or asp ? if i put it in asp then will it run in the sql ?
or where can i put it in access that it will run when i call an sql
from asp... ? something like this:

select document_name, address1:getaddressdata([peripheral], "address1")
from mytable

regards,
shripal.
You might want to post your question again...with my code. The reason I
say so is 1) I'm not that familiar with ASP and 2) very, very few people
look back at reply's over a day old unless they may be following the
thread. The reason I bothered to check is that I spent more than 2
minutes writing some code that works and wanted to see if you'd reply.

My take on it? If the ASP is using an Access database as the back end,
and it is calling the Access query (with maybe the function call in a
module in the back end), it would work within Access. If it doesn't and
ASP runs VBScript, I suppose you could return the memo field and keep
the control for that hidden and then make the control sources parse the
field. For example, in an Access form I can make the control source
=getaddressdata([peripheral], "address1")
and it will return the info from the function call to getaddressdata.

Many of the heavyweights here know ASP, or have a general concept of it.
I again suggest a repost...along with the function...or else a
reference that getaddressdata([peripheral], "address1") is an Access
function call that extracts the data in a memo field for address1. If
you don't get a good response then post your question to an ASP
newsgroup that has familiarity with vbscript or programming.


salad wrote:
shripaldalal wrote:
hi all,

i have the following fields....

Document_Name, Document_No, Document_Date, Order_No, Order_Date,
Peripheral

The first 5 you can understand, peripheral is a memo field which
contains all less important (but important!) details like Address1,
Address2, Place_Of_Delivery in a comma delimited string such as:

Address1:Princess Street;Address2:Mumbai;Place_Of_Delivery:Bhiwandi;

I have already done something like this

select document_no, document_date, order_no, order_date,
getperipheral(Place_Of_Delivery) as Delivery_Place from mastertable

then getperipheral(Place_Of_Delivery) i replace with mid(peripheral,
instr(peripheral, 'Place_Of_Delivery') + 17, instr(instr(peripheral,
'Place_Of_Delivery'), peripheral, ';') - instr(peripheral,
'Place_Of_Delivery') - 17)

so i sql looks like

select document_no, document_date, order_no, order_date,
getperipheral(Place_Of_Delivery) i replace with mid(peripheral,
instr(peripheral, 'Place_Of_Delivery') + 17, instr(instr(peripheral,
'Place_Of_Delivery'), peripheral, ';') - instr(peripheral,
'Place_Of_Delivery') - 17) as Delivery_Place from mastertable

This method also works fortunately but there is only one huge
problem....

if place of delivery is not there at all.... and peripheral field is
blank.....then the ENTIRE RECORD DOES NOT SHOW UP OR THERE IS AN
ERROR.......is there any inbuilt function in access that can do
this.....this is a night mare.......

thanks,
shripal dalal.


On something like this I'd create a function. Something similar to the
following function. Insert this in a module and test.

Public Function GetAddressData(strAddr, strType) As String
Dim intPos As Integer
Dim strData As String

If Not Isnull(strAddr) then
'see if that section of address exists. If so, get
'the beginning of the end of the word
intPos = InStr(strAddr, strType)

'get start of the field data if found
If intPos > 0 Then strData = Mid(strAddr, _
intPos + Len(strType) + 1)

'if strData is empty, then no data for that field
If strData > "" Then
'look for field terminating ";" character
intPos = InStr(strData, ";")

If intPos > 0 Then
GetAddressData = Left(strData, intPos - 1)
Else
'field was not terminated at end with a ;
GetAddressData = strData
End If
End If
endif
End Function

Now you can create columns in the query using the following. If I
understood correctly, Peripheral is the memo field name
Address1:GetAddressData([Peripheral],"Address1")
Address2:GetAddressData([Peripheral],"Address2")
Place_Of_Delivery:GetAddressData([Peripheral],"Place_Of_Delivery")

This parses out the 3 fields.


Jan 20 '06 #4

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

Similar topics

2
by: john smith | last post by:
I'm wondering if it's possible to declare a pure virtual member function? Ie is: class A{ public: virtual static void f() const = 0; }; legal? I'm getting compile errors for code that used...
10
by: smorrey | last post by:
Hello all, this might better be suited for the MySQL newsgroup, but I figured I'ld post here and see if anyone can help me. I'm trying to create a simple transaction handling system where users...
7
by: Shannan Casteel via AccessMonster.com | last post by:
I have a form for entering part numbers along with the associated quantity for each part. There are 25 Part fields and 25 associated Quantity fields. If I go to record 1 and enter part number 1234...
175
by: Ken Brady | last post by:
I'm on a team building some class libraries to be used by many other projects. Some members of our team insist that "All public methods should be virtual" just in case "anything needs to be...
34
by: antonyliu2002 | last post by:
I've set up the virtual smtp server on my IIS 5.1 like so: 1. Assign IP address to "All Unassigned", and listen to port 25. 2. Access Connection granted to "127.0.0.1". 3. Relay only allow...
2
by: groupy | last post by:
Hello all, my question might be trivial but since my background isn't DB i'll dare to ask it any way: how to create a real (not virtual) table from view1 & view2 ni sql server? what should i...
7
by: Markus Svilans | last post by:
Hello, My question involves virtual functions and inheritance. Suppose we have a class structure, that consists of "data" classes, and "processor" classes. The data classes are derived from...
23
by: Dave Rahardja | last post by:
Since C++ is missing the "interface" concept present in Java, I've been using the following pattern to simulate its behavior: class Interface0 { public: virtual void fn0() = 0; };
5
by: Paulo | last post by:
Hi, how can I use any logic to mount a search sql statement based on the fields the user fills, example: Name: SomeCode: Birth: if name <empty the sql will be: select fields from table where...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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,...
0
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...
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...
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
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...

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.