473,387 Members | 1,891 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

updateqry

23
I have what is a complicated update qry I haven't been able to make work. I have a form that is filtered by the following qry. Me.Filter = "[dateofsession] Between forms![billingtransmitted]![beginningdate]And forms![billingtransmitted]![EndingDate] and [selected] = true"
FilterOn = True
Selected are claims between certain dates to be sent to various insurance companies..
Ok now I want to update all the selected records by changing the field billingselected to true. I tried this but it doesn't work

CurrentDb.Execute "UPDATE insurance INNER JOIN (Clients INNER JOIN Billing ON Clients.NameID = Billing.LookupClientName) ON insurance.insurance = Clients.Insurance SET Billing.BillingSelected = True WHERE (Billing.DateOfSession Between " & Me![BeginningDate] & " And " & Me![EndingDate] & " ) AND ([insurance].[selected]=True);"

Any suggestions or easier solutions are much appreciated. Alan
Nov 17 '07 #1
2 1192
FishVal
2,653 Expert 2GB
Hi, allj.

Two points.
  • date constant in SQL expression has to be enclosed in # marks
    e.g.
    Expand|Select|Wrap|Line Numbers
    1. WHERE (Billing.DateOfSession Between #" & Me![BeginningDate] & "# And #" & Me![EndingDate] & "#)"
    2.  
  • date must be in m/d/y format; if your form control has other format, then it's content has to be formatted properly before passing to SQL statement
    e.g.
    Expand|Select|Wrap|Line Numbers
    1. WHERE (Billing.DateOfSession Between #" & Format(Me![BeginningDate], "mm/dd/yyyy") & "# And #" & Format(Me![EndingDate], "mm/dd/yyyy") & "#)"
    2.  

Regards,
Fish.
Nov 17 '07 #2
allj
23
Thank you.
I continued to have syntax problems but solved the issue with the following code:

Dim ck As checkbox
Set ck = Me!BillingSelected

If ck = "0" Then
CurrentDb.Execute "UPDATE billing SET [billingselected] = true WHERE [dateofsession] like( #" & Me![DateOfSession] & "#);"
Me.Recalc
CurrentDb.Execute "UPDATE billing SET [billingselected] = true WHERE [billingselected]=true"
Me.Recalc
Else
CurrentDb.Execute "UPDATE billing SET [billingselected] = false WHERE [billingselected]=true"
Me.Recalc
End If

Thanks again
Nov 17 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: deko | last post by:
I'm a little nervous about slamming my database with a dozen Update queries in a loop that all modify RecordSources of open forms. Will the use of DoEvents and/or a Sleep function ameliorate any...
1
by: roshina | last post by:
Hi Iam facing a problem in my project, developing a web site for online shopping in ASP on windows XP using IIS server. All the validations are ok but the new password is not upadated in the data...
0
by: shahDeveloper | last post by:
i have created a number of combo boxes according to my need.no i want to save the changes when any one click update button,but here the control did not find by findcontrol function. Dim i, j, totc...
3
by: allj | last post by:
I want users to be able to name the switchboard. I added a new field in the switchboard items table called name and changed the labels to txtboxs with a record source to name. If this isnull a form...
4
by: vanithapraveen | last post by:
I gave update command inside for loop.. and the query values are perfectly correct..but when i give con.execute(updateqry) i end up with an error.... Please help me...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.