upDate Query

peterbowles

Registered User.
Local time
Today, 20:13
Joined
Oct 11, 2002
Messages
163
Please can anyone tell me how to make a update query that updates a fields certan fields on a form. I want to be able to run it off a button

Thanks
 
Why dont you use SQL?

"UPDATE tblSomeTable SET Field1 = True AND Field2 = False WHERE RecordID = " & recordID

Then you can use DoCmd.RunSQL method

Jon
 
Re: Re: upDate Query

Sorry don't quite understand how to do it

The table needed to be update is
Link

The field is
ModuleStatus

And I want to chage the value from "Current" To "MarksPending"
 
Re: Re: Re: upDate Query

Code:
Dim strSQL as String

strSQL = "UPDATE Link SET ModuleStatus = 'MarksPending'"

DoCmd.RunSQL strSQL
Jon
 
Re: Re: Re: Re: upDate Query

me Again (Sorry)

Slmost got it working. Using This;

Private Sub Command7_Click()
Dim strSQL As String
Dim search As String
search = "Me.CboMod"
strSQL = "UPDATE Link SET ModuleStatus = 3 WHERE ModuleNumber = Search "

DoCmd.RunSQL strSQL

End Sub

Keeps asking for the Perameters for "Search" the Search is on a Sub form called "SubfrmViewMarks" which on the "MainfrmMarks"

any help would be great

Thanks
 
Re: Re: Re: Re: Re: upDate Query

strSQL = "UPDATE Link SET ModuleStatus = 3 WHERE ModuleNumber = " & Forms!frmYourMainForm!frmYourSubForm.Form!yourControl.Value

DoCmd.RunSQL strSQL
 
Hi Again
If you wanted to put the up date query on another from

Dim dif As String

dif = DateDiff("m", Date, [EndDate])

Dim strSQL As String
strSQL = "UPDATE Student SET NearCompletion = Yes WHERE dif <= 12 And >0 "

DoCmd.RunSQL strSQL

How do you do that. Also Each records Primary key is "StudentNumber" Can you display which StudentNumber have been Updated in a msg box

Thanks for any hep in advance
 
Copy and paste the code into another form.

Or create a module as a public function and place that code there.

Jon
 

Users who are viewing this thread

Back
Top Bottom