473,509 Members | 3,039 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Help - Populating a field in a datafeed based on values in another field

Hi - I'm trying to create a datafeed from a Microsoft Access database
but I am having a problem due to my lack of experience.

I have to populate a field with a delivery cost but this is not held
on the database.

What is held on the database is the price of the product.

The delivery cost is based on the price of the product.

A product costing up to £20 will cost £1.50 delivery.
A product costing more than £20.00 will cost £4.50 delivery.

I assume that this can be done using VB code in a module.

Any help would be appreciated.
Nov 13 '05 #1
4 1351
In message <ps********************************@4ax.com>, skinnybloke
<th**************@yahoo.co.uk> writes
Hi - I'm trying to create a datafeed from a Microsoft Access database
but I am having a problem due to my lack of experience.

I have to populate a field with a delivery cost but this is not held
on the database.

What is held on the database is the price of the product.

The delivery cost is based on the price of the product.

A product costing up to £20 will cost £1.50 delivery.
A product costing more than £20.00 will cost £4.50 delivery.

I assume that this can be done using VB code in a module.


That's one way. Another way is to add a calculated field to a view

DelCost: iif(ProdCost >20.0, 4.5, 1.5)

You can then easily change the threshold and delivery charges.

One word of warning. This approach will recalculate the cost each time
the query is run. For invoicing purposes you should store the actual
value charged rather than relying on recalculating the figure each time
it is referenced. The formula may change and the new formula would give
a different result.

--
Bernard Peek
London, UK. DBA, Manager, Trainer & Author.

Nov 13 '05 #2
Hi Bernard - I want this to work for a query and not a view. Can I put
this into a SQL statement?
On Tue, 1 Nov 2005 16:27:17 +0000, Bernard Peek <ba*@shrdlu.com>
wrote:
In message <ps********************************@4ax.com>, skinnybloke
<th**************@yahoo.co.uk> writes
Hi - I'm trying to create a datafeed from a Microsoft Access database
but I am having a problem due to my lack of experience.

I have to populate a field with a delivery cost but this is not held
on the database.

What is held on the database is the price of the product.

The delivery cost is based on the price of the product.

A product costing up to £20 will cost £1.50 delivery.
A product costing more than £20.00 will cost £4.50 delivery.

I assume that this can be done using VB code in a module.


That's one way. Another way is to add a calculated field to a view

DelCost: iif(ProdCost >20.0, 4.5, 1.5)

You can then easily change the threshold and delivery charges.

One word of warning. This approach will recalculate the cost each time
the query is run. For invoicing purposes you should store the actual
value charged rather than relying on recalculating the figure each time
it is referenced. The formula may change and the new formula would give
a different result.

Nov 13 '05 #3

Hi Bernard - I want this to work for a query and not a view. Can I put
this into a SQL statement?


Sorry, I forgot which database I was working with. Queries and views are
the same thing. So yes, it will work in a query.

In newsgroups I find that it's usually best to post replies below the
text they are commenting on, and to snip any non-essential part of the
message you are replying to.
--
Bernard Peek
London, UK. DBA, Manager, Trainer & Author.

Nov 13 '05 #4
On Tue, 1 Nov 2005 23:49:40 +0000, Bernard Peek <ba*@shrdlu.com>
wrote:

Hi Bernard - I want this to work for a query and not a view. Can I put
this into a SQL statement?


Sorry, I forgot which database I was working with. Queries and views are
the same thing. So yes, it will work in a query.


Hi Bernard - this has worked a treat - thanks for your help.

David
Nov 13 '05 #5

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

Similar topics

0
482
by: Preston Landers | last post by:
Hello all. I am trying to write a query that "just" switches some data around so it is shown in a slightly different format. I am already able to do what I want in Oracle 8i, but I am having...
21
2670
by: Dan | last post by:
Hi, just ran into my first instance of a backend Access97 database not compacting. I'm getting the "MSACCESS.EXE has generated errors.." message on compact. I've narrowed it down to the largest...
3
3139
by: ssb | last post by:
Hello, This may be very elementary, but, need help because I am new to access programming. (1) Say, I have a column EMPLOYEE_NAME. How do I fetch (maybe, cursor ?) the values one by one and...
11
2778
by: my-wings | last post by:
I think I've painted myself into a corner, and I'm hoping someone can help me out. I have a table of books (tblBooks), which includes a field (strPubName) for Publisher Name and another field...
6
508
by: Don Sealer | last post by:
I've written this expression for a DLookup function. It works almost alright. What I'm trying to do is type in a description and the ID field (number) populates automatically. It works almost as...
28
1859
by: Siv | last post by:
Hi, If I run the following: strSQL = "Select * FROM Clients;" da = New OleDb.OleDbDataAdapter(strSQL, Conn) 'Create data adapter cb = New OleDb.OleDbCommandBuilder(da) ...
4
4602
by: jon f kaminsky | last post by:
Hi- I've seen this problem discussed a jillion times but I cannot seem to implement any advice that makes it work. I am porting a large project from VB6 to .NET. The issue is using the combo box...
2
3136
by: sorobor | last post by:
dear sir .. i am using cakephp freamwork ..By the way i m begener in php and javascript .. My probs r bellow I made a javascript calender ..there is a close button ..when i press close button...
3
3555
by: davenumber40 | last post by:
I’m creating a small database in Access 2003(XP) to track issues during software testing. As far as databases go, it’s going to be a relatively small, short term project (No more than 20,000 records...
0
7136
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
7344
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
7412
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
7069
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
7505
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...
1
5060
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...
0
3203
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1570
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 ...
0
441
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...

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.