472,796 Members | 1,369 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,796 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 5315
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...
0
linyimin
by: linyimin | last post by:
Spring Startup Analyzer generates an interactive Spring application startup report that lets you understand what contributes to the application startup time and helps to optimize it. Support for...
0
by: kcodez | last post by:
As a H5 game development enthusiast, I recently wrote a very interesting little game - Toy Claw ((http://claw.kjeek.com/))。Here I will summarize and share the development experience here, and hope it...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Sept 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
by: Taofi | last post by:
I try to insert a new record but the error message says the number of query names and destination fields are not the same This are my field names ID, Budgeted, Actual, Status and Differences ...
14
DJRhino1175
by: DJRhino1175 | last post by:
When I run this code I get an error, its Run-time error# 424 Object required...This is my first attempt at doing something like this. I test the entire code and it worked until I added this - If...
0
by: Rina0 | last post by:
I am looking for a Python code to find the longest common subsequence of two strings. I found this blog post that describes the length of longest common subsequence problem and provides a solution in...
5
by: DJRhino | last post by:
Private Sub CboDrawingID_BeforeUpdate(Cancel As Integer) If = 310029923 Or 310030138 Or 310030152 Or 310030346 Or 310030348 Or _ 310030356 Or 310030359 Or 310030362 Or...
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
0
by: Mushico | last post by:
How to calculate date of retirement from date of birth

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.