473,378 Members | 1,393 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,378 software developers and data experts.

update query based on dates

done homework on Usenet and still stuck...

I have a parameter query that asks the user to input the 'slip reference'
based on the accounting period. This has now changed slightly so that the
slip reference number is based on the date, so for instance if the date is
as follows, the slip reference is as follows:

J12345 21/08/2003
J12346 22/08/2003
J12347 23/08/2003
J12348 24/08/2003
J12349 25/08/2003
J12350 26/08/2003
J12351 27/08/2003
J12352 28/08/2003
J12353 29/08/2003
J12354 30/08/2003
J12355 31/08/2003
J12356 01/09/2003
J12357 02/09/2003
J12358 03/09/2003
J12359 04/09/2003
J12360 05/09/2003
J12361 06/09/2003
J12362 07/09/2003
And so on...

So the user doesn't have to enter a slip ref

I have a table called 'slips' just like the example above, filled up with
slip ref's and dates to cover a year or so. In a table I have a field
called ec_vat_num, I'd like this field populated with the slip ref based on
the input date (again I have a field in this table with the input date
already filled up) and run from a query.

I'm struggling with the access update syntax. Can anyone assist? Thank you.

Lap


--
Thanks,
Chris
cc****@NOSPAMeclipse.co.uk
Nov 12 '05 #1
3 5346
thanks
--
Thanks,
Chris
cc****@NOSPAMeclipse.co.uk

"HJ" <hj******@hotmail.com> wrote in message
news:3f***********************@dreader6.news.xs4al l.nl...
If the input date has already been entered, you may use an inner join to
solve your problem.

UPDATE ec_vat_table INNER JOIN tblSlip ON ec_vat_table.inputdate =
tblSlip.slipDate SET ec_vat_table.ec_vat_num = [slipSlipRef];

HJ

"Lapchien" <cc****@NOSPAMeclipse.co.uk> wrote in message
news:10*************@ananke.eclipse.net.uk...
done homework on Usenet and still stuck...

I have a parameter query that asks the user to input the 'slip reference' based on the accounting period. This has now changed slightly so that the slip reference number is based on the date, so for instance if the date is as follows, the slip reference is as follows:

J12345 21/08/2003
J12346 22/08/2003
J12347 23/08/2003
J12348 24/08/2003
J12349 25/08/2003
J12350 26/08/2003
J12351 27/08/2003
J12352 28/08/2003
J12353 29/08/2003
J12354 30/08/2003
J12355 31/08/2003
J12356 01/09/2003
J12357 02/09/2003
J12358 03/09/2003
J12359 04/09/2003
J12360 05/09/2003
J12361 06/09/2003
J12362 07/09/2003
And so on...

So the user doesn't have to enter a slip ref

I have a table called 'slips' just like the example above, filled up with slip ref's and dates to cover a year or so. In a table I have a field
called ec_vat_num, I'd like this field populated with the slip ref based

on
the input date (again I have a field in this table with the input date
already filled up) and run from a query.

I'm struggling with the access update syntax. Can anyone assist? Thank

you.

Lap


--
Thanks,
Chris
cc****@NOSPAMeclipse.co.uk


Nov 12 '05 #2
Lap,

I think you could write a simple function in VBA to generate the 'slip-reference':

Public Function slipref(Optional InputDate As Date = 0) As String
Dim result As String
Dim datevalue As Date
If InputDate = 0 Then datevalue = Date Else datevalue = InputDate
result = "J" & Format(CLng(Int(datevalue) - 25509), "00000")
End Function

By declaring the function public it also can be used in a SQL-expression.
When no parameter is given, the actual slipref will be returned.

Marc

"Lapchien" <cc****@NOSPAMeclipse.co.uk> wrote in message news:<10*************@ananke.eclipse.net.uk>...
done homework on Usenet and still stuck...

I have a parameter query that asks the user to input the 'slip reference'
based on the accounting period. This has now changed slightly so that the
slip reference number is based on the date, so for instance if the date is
as follows, the slip reference is as follows:

J12345 21/08/2003
J12346 22/08/2003
J12347 23/08/2003
J12348 24/08/2003
J12349 25/08/2003
J12350 26/08/2003
J12351 27/08/2003
J12352 28/08/2003
J12353 29/08/2003
J12354 30/08/2003
J12355 31/08/2003
J12356 01/09/2003
J12357 02/09/2003
J12358 03/09/2003
J12359 04/09/2003
J12360 05/09/2003
J12361 06/09/2003
J12362 07/09/2003
And so on...

So the user doesn't have to enter a slip ref

I have a table called 'slips' just like the example above, filled up with
slip ref's and dates to cover a year or so. In a table I have a field
called ec_vat_num, I'd like this field populated with the slip ref based on
the input date (again I have a field in this table with the input date
already filled up) and run from a query.

I'm struggling with the access update syntax. Can anyone assist? Thank you.

Lap

Nov 12 '05 #3
Lap,

I think you could write a simple function in VBA to generate the 'slip-reference':

Public Function slipref(Optional InputDate As Date = 0) As String
Dim result As String
Dim datevalue As Date
If InputDate = 0 Then datevalue = Date Else datevalue = InputDate
result = "J" & Format(CLng(Int(datevalue) - 25509), "00000")
End Function

By declaring the function public it also can be used in a SQL-expression.
When no parameter is given, the actual slipref will be returned.

Marc

"Lapchien" <cc****@NOSPAMeclipse.co.uk> wrote in message news:<10*************@ananke.eclipse.net.uk>...
done homework on Usenet and still stuck...

I have a parameter query that asks the user to input the 'slip reference'
based on the accounting period. This has now changed slightly so that the
slip reference number is based on the date, so for instance if the date is
as follows, the slip reference is as follows:

J12345 21/08/2003
J12346 22/08/2003
J12347 23/08/2003
J12348 24/08/2003
J12349 25/08/2003
J12350 26/08/2003
J12351 27/08/2003
J12352 28/08/2003
J12353 29/08/2003
J12354 30/08/2003
J12355 31/08/2003
J12356 01/09/2003
J12357 02/09/2003
J12358 03/09/2003
J12359 04/09/2003
J12360 05/09/2003
J12361 06/09/2003
J12362 07/09/2003
And so on...

So the user doesn't have to enter a slip ref

I have a table called 'slips' just like the example above, filled up with
slip ref's and dates to cover a year or so. In a table I have a field
called ec_vat_num, I'd like this field populated with the slip ref based on
the input date (again I have a field in this table with the input date
already filled up) and run from a query.

I'm struggling with the access update syntax. Can anyone assist? Thank you.

Lap

Nov 12 '05 #4

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

Similar topics

4
by: Surendra | last post by:
I have this query that I need to use in an Update statement to populate a field in the table by the value of Sq ---------------------------------------------------------------------------- Inline...
9
by: Dom Boyce | last post by:
Hi First up, I am using MS Access 2002. I have a database which records analyst rating changes for a list of companies on a daily basis. Unfortunately, the database has been set up (by my...
4
by: Ruben | last post by:
Hi, I have a continuous form that provides a listing of various instruments that are serviced on a monthly to annual basis, with general info about the instrument, last and next service dates,...
6
by: KevinPreston | last post by:
Hello everyone, this is my first post so apologies if i dont get it right first time, i am a self taught Access user, i am stuck on something i am trying to do, briefly i have 2 tables, one for...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.