Link to home
Start Free TrialLog in
Avatar of Hiroyuki Tamura
Hiroyuki TamuraFlag for United States of America

asked on

MS Access, How to create variable

I would like to create a variable to set "2017/03"

I need to change following part, red rectangle part, every month.
is there a way to set one input to change "2017/03" to "2017/04"
User generated image
User generated image
User generated image
ASKER CERTIFIED SOLUTION
Avatar of Rey Obrero (Capricorn1)
Rey Obrero (Capricorn1)
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Hiroyuki Tamura

ASKER

Thank you. Which view should i use? design view or sql?
go to SQL view, copy and paste the sql statement  I posted.
after that , you can also switch to design view
You really shouldn't store dates as text. Never.

/gustav
sorry, not sure how to input.
User generated image
@Hiroyuki Tamura
1. copy the query below

Update tblHour
 Set [Hour]=Replace([Hour],"2017/03","2017/04")
 Where Instr([Hour],"2017/03")>0

2. create a new query, go to SQL view and paste the query you copied
3. run the query
Thank you, Rey
somehow replace function not working.
User generated image
User generated image
User generated image
saved the query you created "Query3"
do a compact and repair

run the query
view the table tblHour
User generated image
Thank you, Rey
you are right. it is working.