473,403 Members | 2,323 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,403 software developers and data experts.

Setting a default date with multiple criteria

I am an extreme newbie to Access and need help setting a default date
on a form.
The situation is:
I have a field called date_received which is set to default to today's
date.
I have another field called date_sent which must be sent to either 10,
14, 20 or 21 days after the date_received based on multiple fields
which the user selects. These field are both combo boxes and the user
must select an existing value.

I know how to build case statements in SQL but the syntax in VB is
eluding me - the pseudo code would be something like:

If process_server_code like IRS set the sent_date to 21 days after the
received_date.
If process_server_code like Child Support set the sent_date to 14 days
after the received_date.
If state = WA set the sent_date to 20 days after the received_date.
Else set sent_date to 10 days after the received date.

I know this would work in SQL because it would assign the values based
on the first one that it hit that was true - but have no idea how to
make this happen in Access.
Any help would be appreciated, thanks.
Nov 13 '05 #1
1 2203
Anna, Something like this(Air Code-Not tested):

Select Case Me.[process_server_code]
Case "IRS"
Me.[sent_date] = ((Me.[received_date]) + 21)
Exit Sub
Case "Child Support"
Me.[sent_date] = ((Me.[received_date]) + 14)
Exit Sub
End Select

If Me.[state] = "WA" Then
Me.[sent_date] = ((Me.[received_date]) + 20)
Exit Sub
Else
Me.[sent_date] = ((Me.[received_date]) + 10)
Exit Sub
End If

--
Reggie

----------
"Anna" <an**********@gci.net> wrote in message
news:65**************************@posting.google.c om...
I am an extreme newbie to Access and need help setting a default date
on a form.
The situation is:
I have a field called date_received which is set to default to today's
date.
I have another field called date_sent which must be sent to either 10,
14, 20 or 21 days after the date_received based on multiple fields
which the user selects. These field are both combo boxes and the user
must select an existing value.

I know how to build case statements in SQL but the syntax in VB is
eluding me - the pseudo code would be something like:

If process_server_code like IRS set the sent_date to 21 days after the
received_date.
If process_server_code like Child Support set the sent_date to 14 days
after the received_date.
If state = WA set the sent_date to 20 days after the received_date.
Else set sent_date to 10 days after the received date.

I know this would work in SQL because it would assign the values based
on the first one that it hit that was true - but have no idea how to
make this happen in Access.
Any help would be appreciated, thanks.

Nov 13 '05 #2

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

Similar topics

10
by: Kenneth | last post by:
I have a Query that consist of a lot of different sales data, and one of the colums are different date. The date goes from 1jan2003 til 31jan2003. in this Query I only want the salesdata for...
2
by: Andy | last post by:
Hello, I have a question regarding how to format a date in VB so that I can call it from a query and get results. I'm calling functions in the query because that was the only way I found I could...
12
by: Steve Elliott | last post by:
I have a query set up to gather together data between two specified dates. Shown in the query column as: Between #24/09/2004# And #01/10/2004# Is it possible to enter several different date...
4
by: S. van Beek | last post by:
Dear reader, By a Date field with Now() as default value the content of the field is date plus time. As I need a filter in a query on date only (excluding time) I invented the following...
18
by: Dixie | last post by:
Can I set the Format property in a date/time field in code? Can I set the Input Mask in a date/time field in code? Can I set the Format of a Yes/No field to Checkbox in code? I am working on...
8
by: David Lozzi | last post by:
Howdy, I have a user control that is a report to display data. On the page the control is inserted in, I have filter options to filter the report. When I try to do something like this, nothing...
6
by: MLH | last post by:
I have a form named frmVehicleEntryForm. It has a 3-tab tab control. On the 2nd tab page, there's a textbox named VehicleLocationName whose default value setting is ...
6
by: jim | last post by:
Is anyone able to provide me with a link to useful documentation or just outright explain to me how to set query parameters dynamically? I'm really new to Access and databases in general but I...
0
by: iamclippy | last post by:
Hello, Where I work, we are hosting several ASP.NET web applications on Windows Server 2003. Each application needs to have a different date format. What is the best way to implement this? ...
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...
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
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...
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
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.