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

Problem with Generating a schedule...

Experts,
I encountered an "Type Mismatch" error when trying to run the
following codes... What I wanted to do was to have the codes generate
a 2 weeks schedule with just populating the date fields of a table and
leaving the other fields with the same table blank or as is... then
users can change the values of the other fields without having to fill
in all the dates. Thanks in advance.

------------------------------------------------------------
On Error GoTo OK_Click_Error

Dim emp As Recordset
Dim dblCurrentDate As Date
Dim dblBeginDate As Date
Dim dblEndDate As Date

Dim lngResourceID As Long
Dim strCriteria As String

If Me![BeginDate] > Me![EndDate] Then
MsgBox "End date cannot be less than begin date."
DoCmd.GoToControl "BeginDate"
Exit Sub
End If

DoCmd.Hourglass True

dblBeginDate = Me![BeginDate]
dblEndDate = Me![EndDate]
dblCurrentDate = dblBeginDate

Set dbs = CurrentDb()
Set emp = dbs.OpenRecordset("Employees", dbOpenDynaset)
Set rstSchedule = dbs.OpenRecordset("WorkContents", dbOpenDynaset)

While (Not emp.EOF)
emp.MoveNext
lngResourceID = emp![EmployeeID]

While dblCurrentDate <= dblEndDate
rstSchedule.AddNew
rstSchedule![EmployeeID] = lngResourceID
rstSchedule![WorkDate] = dblCurrentDate
rstSchedule.Update

dblCurrentDate = dblCurrentDate + 1
Wend
Wend ' 1st while

DoCmd.Close acForm, "Generate"
rstSchedule.Close
emp.Close
dbs.Close

OK_Click_Exit:
DoCmd.Hourglass False
Exit Sub

OK_Click_Error:
MsgBox Err.Description
Resume OK_Click_Exit
End Sub
------------------------------------------------------------------

Sincerely,
Perry
Nov 12 '05 #1
1 1661
pe******@yahoo.com (PerryC) wrote in
news:ea**************************@posting.google.c om:
Experts,
I encountered an "Type Mismatch" error when trying to run
the
following codes... What I wanted to do was to have the codes
generate a 2 weeks schedule with just populating the date
fields of a table and leaving the other fields with the same
table blank or as is... then users can change the values of
the other fields without having to fill in all the dates.
Thanks in advance.

Temporarily comment out the On Error Goto statement and use the
debugger to show you where your error is.

I suspect that it's the use of doubles instead of dates. (A
datetime record is a type of double, but Access treats them
separately).
Bob Quintal
------------------------------------------------------------
On Error GoTo OK_Click_Error

Dim emp As Recordset
Dim dblCurrentDate As Date
Dim dblBeginDate As Date
Dim dblEndDate As Date

Dim lngResourceID As Long
Dim strCriteria As String

If Me![BeginDate] > Me![EndDate] Then
MsgBox "End date cannot be less than begin date."
DoCmd.GoToControl "BeginDate"
Exit Sub
End If

DoCmd.Hourglass True

dblBeginDate = Me![BeginDate]
dblEndDate = Me![EndDate]
dblCurrentDate = dblBeginDate

Set dbs = CurrentDb()
Set emp = dbs.OpenRecordset("Employees", dbOpenDynaset)
Set rstSchedule = dbs.OpenRecordset("WorkContents",
dbOpenDynaset)

While (Not emp.EOF)
emp.MoveNext
lngResourceID = emp![EmployeeID]

While dblCurrentDate <= dblEndDate
rstSchedule.AddNew
rstSchedule![EmployeeID] = lngResourceID
rstSchedule![WorkDate] = dblCurrentDate
rstSchedule.Update

dblCurrentDate = dblCurrentDate + 1
Wend
Wend ' 1st while

DoCmd.Close acForm, "Generate"
rstSchedule.Close
emp.Close
dbs.Close

OK_Click_Exit:
DoCmd.Hourglass False
Exit Sub

OK_Click_Error:
MsgBox Err.Description
Resume OK_Click_Exit
End Sub
---------------------------------------------------------------
---

Sincerely,
Perry


Nov 12 '05 #2

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

Similar topics

0
by: Rob Welch | last post by:
I am changing my church band scheduling system from Excel to Database. I have assigned a schedule table in MySQL database that will be my master schedule. It contains the following fields: ...
7
by: patbaudy | last post by:
Hi, I'm coding a shopping cart in asp. I store all info about ordered items, customer's coordonates, etc...into cookies. When the order is complete I use "CDONTS.NewMail" to send an order...
1
by: mahesh j k | last post by:
Table1: RouteID RDate Direction RTime Employee_ID ArrTime R1 6/15/2005 Pick 6/15/2005 9:30:00 AM 1430 6/15/2005 8:12:00 AM R2 6/15/2005 Pick 6/15/2005 3:00:00...
2
by: Jake | last post by:
Hi, I originally posted in the db group but thought this might be more appropriate here. I have a scheduling application which allows the user to reserve timeslots for various things but I'm...
3
by: Dominic Feron | last post by:
Hello everyone, Here is the situation. I've looked all day about this subject over the net and I'm kinda confused... I was ask to generate, on a daily basis, some XML files from a SQL Server...
0
by: ImraneA | last post by:
Hi there Have a database, where front-end interface allows user to select a ms access database. From there, standard tables are linked. Routine, that creates a spreadsheet, for each table a...
1
by: RahimAsif | last post by:
Hi guys, I would like some advice on thread programming using C# so I wanted some advice. I am writing an application that communicates with a panel over ethernet, collects data and writes it...
0
by: raa abdullah | last post by:
Overview A conflict-serializbility\recoverability checker, SCR, is a program that takes in a schedule and outputs 2 decisions: Conflict serialzable or Not confilict serializable AND Recoverable or...
1
damonreid
by: damonreid | last post by:
Access 2003 Microsoft Windows XP Pro Hey, I am currently pulling my hair out here. I have a Form for adding new projects to a database, the only problem is that when I close the form it doesn't...
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: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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...

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.