composite key

cezalinho

Registered User.
Local time
Today, 13:08
Joined
Jan 23, 2006
Messages
10
hello

how can i create compostie keys in access???

also how would validation rule for a text box which would allow a user to enter a date which between a certain range in relation to today's date. eg the date entered cannot be more than one week greater than the current date. i knew who i could do it using VBA but i want to know how to do to using the regular access features.

thanks you :)
 
sorry i got one more question how could i get the day of a given date??

eg if the user enters a date it says "friday"

is there a function in vba that could do this???
 
cezalinho said:
how can i create compostie keys in access???
in table design, highlight the two (or more) fields you want as your composite key and click the key on the menu.

also how would validation rule for a text box which would allow a user to enter a date which between a certain range in relation to today's date. eg the date entered cannot be more than one week greater than the current date. i knew who i could do it using VBA but i want to know how to do to using the regular access features.
one way:
in your table, highlight your date field, go to the Validation Rule (below) and type this:
Between Date() And DateAdd("d",7,Date())
In the Validation Text type your error message:
Not a valid date. Must be this week...
 
cezalinho said:
how could i get the day of a given date?? eg if the user enters a date it says "friday". is there a function in vba that could do this???
general formatting:
Format(Date(), "dddd")
 
thank you for the reply :) really appriciate it

1, the composite key works well

2, the for the date i used a variatio of what u said:
> =now() AND < (now() + 7 )
is that a valid way to do it? or is dateadd better??

3, hmm u seem like u know ur stuff :)
 
i think your variation is ok, but in case u don't know, now() gives you the date and time and date() just the date. so i think if you say:
> now()
that means > this very second.
if you say
> date()
that means > than today.
if you say
Between date1 and date2
the dates are inclusive, i.e. the two dates are actually inlcuded in the calculation, it's not actually 'between' the two dates.

dates are always a bit of a challenge...
 

Users who are viewing this thread

Back
Top Bottom