473,387 Members | 1,510 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.

Help with dates, queries, and VBA

365 100+
Bit of a strange one for ya here,

i have table with Day, Month, Year and Weekday codes constructed by a loop that adds one to a recordset to construct a table of dates basically

Day(sdt), month(sdt)...........

sdt = sdt +1

loop until sdt = edt


that works easy

to construct a proper date i am using the CDate formula like so
Cdate([DCode] & " / " & [MCode] & "/ " & [YCode])

Easy right??

i can contruct that in a query and get the query to return the Day code for the date based on a match in a text box.

but i want to run the query in VB so that i can say

If "Value returned" is (weekday number (1-5)) then update other table
else dont

but VB wont accept the "/" and it errors, does anyone know how to write / in VB?

i hope that makes sense
Nov 25 '07 #1
1 1128
MikeTheBike
639 Expert 512MB
Bit of a strange one for ya here,

i have table with Day, Month, Year and Weekday codes constructed by a loop that adds one to a recordset to construct a table of dates basically

Day(sdt), month(sdt)...........

sdt = sdt +1

loop until sdt = edt


that works easy

to construct a proper date i am using the CDate formula like so
Cdate([DCode] & " / " & [MCode] & "/ " & [YCode])

Easy right??

i can contruct that in a query and get the query to return the Day code for the date based on a match in a text box.

but i want to run the query in VB so that i can say

If "Value returned" is (weekday number (1-5)) then update other table
else dont

but VB wont accept the "/" and it errors, does anyone know how to write / in VB?

i hope that makes sense
Hi

All very confusing, but if [CDay] etc are numbers for day, month, year, then I would use the DateSerial() function. This is a very powerfull/flexible function for maniputating dates.

Also, why store the individual parts if the date instead of the date itself?
If you store the date you can easily extact the three part using functions. The same applies to the Weekday also (ie WeekDay() function).

If this is way of beam, then pehaps posting the code would help!

MTB
Nov 26 '07 #2

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

Similar topics

6
by: paii | last post by:
I have a table that stores job milestone dates. The 2 milestones I am interested in are "Ship Date" TypeID 1 and "Revised Ship Date" TypeID 18. All jobs have TypeID 1 only some jobs have TypeID 18....
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...
2
by: Douglas | last post by:
I have a Vehicle MOT field in my table which i have as a Date field I dont really want to hold the year, just 'dd mmm' as MOTs are the same date every year. I have the field on my form as a...
5
by: Alicia | last post by:
Hello everyone based on the data, I created a union query which produces this. SELECT ,,, 0 As ClosedCount FROM UNION SELECT ,, 0 AS OpenedCount, FROM ORDER BY , ;
1
by: prabhukalyan | last post by:
Hi all, I am not so good in queries. here is my problem 2 tables to store the received items (fabric)-- inwardmaster, inwarddetails and after some processing (Dyeing) the items were...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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
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...
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.