Re: Better Coding 2 SQL Commands
- From: Vincent Johns <vjohns@xxxxxxxxxxxxxxxxxx>
- Date: Mon, 17 Oct 2005 10:36:44 GMT
DS wrote:
I have to run 2 SQL commands, This is what I came up with but I'm sure there is a cleaner way. It works but cleaner would be better!
Thanks
DS
Private Sub Command4_Click()
CurrentDb.Execute "INSERT INTO JobsDept(DeptID,JobID) VALUES(" & Forms!DeepJob!DepartmentID & ", " & Me.List0.Column(0) & ")"
Dim MySQL As String DoCmd.SetWarnings False MySQL = "UPDATE JobNames SET [Assigned] = True " & _ "WHERE [JobNameID] = Forms!JobPicker![Text6]; " DoCmd.RunSQL (MySQL) DoCmd.SetWarnings True
DoCmd.Close acForm, "JobPicker" Forms!DeepJob.List44.Requery End Sub
What are you trying to clean up? It looks as if you're making changes to two different Tables. It's not unreasonable to have to use two SQL statements to do that, so I don't see any obvious way to combine them. Or were you considering doing something else?
-- Vincent Johns <vjohns@xxxxxxxxxxxxxxxxxx> Please feel free to quote anything I say here. .
- References:
- Better Coding 2 SQL Commands
- From: DS
- Better Coding 2 SQL Commands
- Prev by Date: Re: New user problems-new record
- Next by Date: Re: Better Coding 2 SQL Commands
- Previous by thread: Better Coding 2 SQL Commands
- Next by thread: Re: Better Coding 2 SQL Commands
- Index(es):
Relevant Pages
|
Loading