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

Conversion Query

Good Afternoon Ladies and Gentlemen of this forum, I had a question for all of you.

I am trying to write a query. The idea of the query is showing when a person needs a new appointment. I now have a query which gives the Last Name, the first date they visited, and a so called 'visit number'.

The visits follow a set pattern. The second appointment is always 10 days after the first one. Then, the third appointment is 2 months after the first appointment. The fourth appointment is half a year after the first appointment, and that goes on for about 8 appointments.

The 'visit number' is a number which indicates this. For instance, the first visit goes with a visit number of 1, the second visit with visit number 2, etc.

So, as said, I now have a query which shows me the last name of a patient, the date for the first visit, and the visit number. What I want is to add an amount of time that first date, depending on the visit number. I then want to output the last name, and the first date plus the amount of time added.

What I imagine is this. I have the first date, and the study number. Somewhere (this is one of the problems, where?) I have a list that says,

if visit number = 1,
then VariableX = 10 days
if visit number = 2,
then VariableX = 2 months


Etc.

I would then make VariableX a field in the query.

Finally, I would make another field, which would be the first_date field plus VariableX, and then output that.

My question consists of 2 parts.

First off, is this the smart way to do this? Is there an easier way? It seems that this is a reasonably straightforward way to me, but I'm not a very experienced programmer.

Secondly, if this is a good idea, then how do I do that? I need to have a list somewhere where that conversion happens, where do I put that? Do I make it a separate table? Can I put this in a query?

I hope someone can help me, because it seems like this might be a common problem.

Thanks on beforehand,

David.

PS: If there is any more information that you need to properly answer my question, I'd be happy to supply, just ask!
Mar 5 '12 #1
2 1184
TheSmileyCoder
2,322 Expert Mod 2GB
Hi there

Overall you give alot of detail in your question, and that does give alot to go on. There are several quite different ways to approach this, but before we start on the solution, lets make sure the problem is even better defined.

The main problem in any advanced application is the human aspect. I think you need to atleast consider some of the questions below:

What if a person cannot schedule a visit on said day? What if he is sick,(or forgets) and never shows up?

Do you want to "book" all visits at that same day (I.e. make all 10 appointments at the beginning), or do you book the following visit during the present visit?

What if the calculation X+Y days schedules a visit for christmas day? Is it ok to move it back/forward 2 days?

Are the visits similar in nature, or are different things supposed to happen on different visits?

Are resources from within your company required to be free and available to monitor the visits? In other words do Person X need to be available for the visit, and should the application factor in his/her availability?


Now, my own suggestion on an approach is going to be somewhat based on what im guesing the answers to the above questions are. I would probably have a button in which I would use code to SUGGEST an apointment. The code would check for the persons last visit, factor in your calculation of days between visits and SUGGEST a day. This day should then be confirmed or perhaps modified a few days back or forward to match when the person can actually fit in a visit. Once that bit is done, I would try to expand the application to take into account when the staff is available for appointments.

I hope this gives basis for some thought. Think it over, and come back with the answers to the questions supplied, and I am sure one of our experts can help with some code.
Mar 5 '12 #2
Mihail
759 512MB
First of all I wish to subscribe to this thread.

To calculate the amount of days based on visit number is quit simple:

Expand|Select|Wrap|Line Numbers
  1. Public Function AmountOfDays(VisitNumber As Integer) As Integer
  2.     Select case VisitNumber
  3.         Case 1
  4.             AmountOfDays = 10
  5.         Case 2
  6.             AmountOfDays = 60
  7.         Case ....
  8.             AmountOfDays = ...
  9.         Case Else
  10.             MsgBox("Is no amount of days defined for visit " & VisitNumber )
  11.             AmountOfDays = 0
  12.     End Select
  13. End Function
So for now your main problems are that that Smiley show you, not "how to".
Mar 6 '12 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

7
by: Thomi Baechler | last post by:
Hello Everybody I run the following query against to identical databases. Execution time on the first DB is 0 seconds, on the other 6 seconds! SELECT dbo.HRMABZ.EMPKEY ,...
13
by: Greg Strong | last post by:
Hello All, Hello All, What are the ToDo's / Gotchas to convert an MDB Access 2K2 database to an Access Project (i.e. ADP) file for the front end using Microsoft SQL Server 2000 Desktop Engine...
15
by: C# Learner | last post by:
Hi, I have a string (System.String) which holds some data. This data is encoding in UTF8 (i.e. anywhere in the string where there should be a single 'é' character, there will be two characters...
0
by: Glyn T | last post by:
Hi, I have 2 classes, say B & C which are both inherited from the same class, A. Class A has a property which is used to hold a reference to a subclassed form. Class A also has a method that...
10
by: Arno R | last post by:
Hi all, I have a database that I need to use in different versions of Access. This is A97 in most places and A2k in a few other locations. (I develop in A97 and convert the db to A2k for these...
1
by: Philip Bondi | last post by:
Hello to all SQL Server junkies who work with non-English characters: For people running scripts from the command line using ANSI files with special characters, it is very important to use isql...
0
by: =?Utf-8?B?RGVuaXMgU29oZXQ=?= | last post by:
Hi all, I've created a new project to test ObjectDataSource component. I've just added a new objectdatasource, configured it (linked to a table) etc ... It works fine on localhost, i can...
3
by: luthriaajay | last post by:
I need to convert a date that I receive from an Input Document to output format Input document date format is: <SettlDt="2009-12-01"> Output format should be:
7
by: bruce.dodds | last post by:
Access seems to be handling a date string conversion inconsistently in an append query. The query converts a YYYYMM string into a date, using the following function: CDate(Right(,2) & "/1/" &...
2
by: dvelst | last post by:
Hi All, I have the following query which was based on a working query in MySQL: (don't be afraid of the size of the query you see below, later on I will concentrate on part of this query) ...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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?
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...

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.