Update Query

  • Thread starter Thread starter Guest
  • Start date Start date
Chey said:
*I would like to press a command button and have it check al
unchecked boxes
in a form. Right now I have to be on the record for it to check.
want it
to check all of them *
You just write this code on the click event of command button:

Private Sub Command31_Click()
If Command31.Caption = "Check All" Then
Check35.Value = True
Check62.Value = True
Command31.Caption = "Uncheck All"
Else
Command31.Caption = "Check All"
Check35.Value = False
Check62.Value = False
End I


-
kashi5
 
Okay I promis i will get this.
1. I made a unboud text box where I will type the date into.
2. When I type this date I want to only see the records with that date.
(I have the form in a datasheet view)

Now when all I see is the date I typed in the unboud box ex. 1/3/06
Now I have three rows
Date Cert by cheyenne
Date Cert by mercedes
Vendor Number

My qurey is CertChey

So now the field Date Cert by mercedes shows all the records that were
certified on 1/3/06. With the click of the command button I want Date Cert
by cheyenne to show now()

I pasted your code and changed all the necessary names to match, and it all
turned red.

Thanks for your patience.



Steve Schapel said:
Chey,

So, is CertbyCheyenne a query?

As I mentioned before, a good way to do this is to put an unbound
textbox on the form, where the date criteria is entered. Take the
[Enter Date] prompt out of the query. And then your code will be
something like this...

CurrentDb.Execute "UPDATE CertbyCheyenne" & _
" SET [Date Cert by cheyene] = Now()" & _
" WHERE [Date Queried]=" &
CLng(Me.TextboxName), dbFailOnError

Hope you can adapt this... I got lost with the "date I queried" and the
"date sent out" and the "date cert by cheyanne" to know which was
which... you sure seem to have a lot of date fields there!

--
Steve Schapel, Microsoft Access MVP

Yes this all goes hand and hand
First I asked for the date to be put in with a click of a button
This was for certifying
now those dates that were certifyied I would like to recall and click a
button for when they were processed.
After I acomplish that then when they are returned back into the office.
The processed procedure is the same as when they return back into the office.
I will have to recall the date. We do one thing a day. So bringing up one
date at a time works the best. I do have my qurey built and now I just need
to know the best way to recall a single date.
 
Oh one more thing I just remembered. If I use just a date to filter a date
and time, don't I need a wild card like an * to grab all the records I am
looking for with that specific date?

Steve Schapel said:
Chey,

So, is CertbyCheyenne a query?

As I mentioned before, a good way to do this is to put an unbound
textbox on the form, where the date criteria is entered. Take the
[Enter Date] prompt out of the query. And then your code will be
something like this...

CurrentDb.Execute "UPDATE CertbyCheyenne" & _
" SET [Date Cert by cheyene] = Now()" & _
" WHERE [Date Queried]=" &
CLng(Me.TextboxName), dbFailOnError

Hope you can adapt this... I got lost with the "date I queried" and the
"date sent out" and the "date cert by cheyanne" to know which was
which... you sure seem to have a lot of date fields there!

--
Steve Schapel, Microsoft Access MVP

Yes this all goes hand and hand
First I asked for the date to be put in with a click of a button
This was for certifying
now those dates that were certifyied I would like to recall and click a
button for when they were processed.
After I acomplish that then when they are returned back into the office.
The processed procedure is the same as when they return back into the office.
I will have to recall the date. We do one thing a day. So bringing up one
date at a time works the best. I do have my qurey built and now I just need
to know the best way to recall a single date.
 
Chey,

Ok, thanks for the further explanation.

Try the code like this...

CurrentDb.Execute "UPDATE CertChey" & _
" SET [Date Cert by cheyenne] = Now()" & _
" WHERE [Date Cert by mercedes]=" &
CLng(Me.TextboxName), dbFailOnError

Replace 'TextboxName' with the actual name of the unbound textbox where
you enter the date criteria. Also, it would be best to set the Format
property of this textbox to a date format.

Ok, we must be getting closer now! :-)
 
wow
This is what I have

Private Sub Command7_Click()
CurrentDb.Execute "UPDATE CertChey" & _
" SET [Date Cert by cheyenne] = Now()" & _
" WHERE [Date Cert by mercedes]=" &
CLng(Me.Text15), dbFailOnError
End Sub
Under Text15 I type the date I want----I formated this to short date
Then I placed the code under the command button. Is this right?

Still I would like to type the date and have it filter those dates, so that
is all I see. Can I put a filter on the text box. I tried this on my own
and that didn't work either.
I must really be screwing things up. I double checked my spelling on
everything to make sure it was all right. the code turns up in red and there
is a syntax error. I am going to be so excited when this works.

Steve Schapel said:
Chey,

Ok, thanks for the further explanation.

Try the code like this...

CurrentDb.Execute "UPDATE CertChey" & _
" SET [Date Cert by cheyenne] = Now()" & _
" WHERE [Date Cert by mercedes]=" &
CLng(Me.TextboxName), dbFailOnError

Replace 'TextboxName' with the actual name of the unbound textbox where
you enter the date criteria. Also, it would be best to set the Format
property of this textbox to a date format.

Ok, we must be getting closer now! :-)

--
Steve Schapel, Microsoft Access MVP

Okay I promis i will get this.
1. I made a unboud text box where I will type the date into.
2. When I type this date I want to only see the records with that date.
(I have the form in a datasheet view)

Now when all I see is the date I typed in the unboud box ex. 1/3/06
Now I have three rows
Date Cert by cheyenne
Date Cert by mercedes
Vendor Number

My qurey is CertChey

So now the field Date Cert by mercedes shows all the records that were
certified on 1/3/06. With the click of the command button I want Date Cert
by cheyenne to show now()

I pasted your code and changed all the necessary names to match, and it all
turned red.

Thanks for your patience.
 
Ok I got the filter to work on the date part. Although I need the time in
there. How do I get around the filter with the time.
Right now what I did was macro-open form, then I did a where condition.
althogh with a where condition it has to be exact. I guess that is what I
meant about a wild card.
 
Chey,

This part...
" WHERE [Date Cert by mercedes]=" & CLng(Me.Text15), dbFailOnError
.... is all supposed to be on one line in the code. Is the word wrap
happening in the newsgroup reader, or is this actually on 2 lines in
your code?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top