syntax for a dlookup
ok I give up!
here is the error...
' Run-time error 3075 Syntax error in query expression '...'
this is the code before that a contractor wrote.
(I dont know if it ever worked....the table was wrong however)
If Nz(DLookup("Fed Budget", "tblBudget" , "([SubgNo] = " & Me.SubgNo & ")
And ([BudgetID] = " & Me.BudgetID & ")"), 0) - ([FedFSRToDate]) < -500
Then
' MsgBox "Overspendi ng " & vbCrLf & vbCrLf & Me.Category &
vbCrLf & vbCrLf & "by more than $500", vbExclamation
this is the code I put in causing and error.
If Nz(DLookup("[BUDGET_FEDERAL]", "[VOCA_BUDGET]",
"([VOCA_BUDGET].[SUBGRANT_NO] = " & Me.SubgNo & ") And
([VOCA_BUDGET].[Budget_ID] = " & Me.BudgetID & ")"), 0) -
([FedFSRToDate]) < -500 Then
MsgBox "Overspendi ng " & vbCrLf & vbCrLf & Me.Category & vbCrLf
& vbCrLf & "by more than $500", vbExclamation
any help? 2 3541
Try removing the [VOCA_BUDGET]. from the criteria section of the DLookup.
--
Doug Steele, Microsoft Access MVP http://I.Am/DougSteele
(no e-mails, please!)
"jwa6" <jw*****@yahoo. com> wrote in message
news:11******** **************@ f14g2000cwb.goo glegroups.com.. . syntax for a dlookup ok I give up!
here is the error... ' Run-time error 3075 Syntax error in query expression '...'
this is the code before that a contractor wrote. (I dont know if it ever worked....the table was wrong however)
If Nz(DLookup("Fed Budget", "tblBudget" , "([SubgNo] = " & Me.SubgNo & ") And ([BudgetID] = " & Me.BudgetID & ")"), 0) - ([FedFSRToDate]) < -500 Then
' MsgBox "Overspendi ng " & vbCrLf & vbCrLf & Me.Category & vbCrLf & vbCrLf & "by more than $500", vbExclamation
this is the code I put in causing and error.
If Nz(DLookup("[BUDGET_FEDERAL]", "[VOCA_BUDGET]", "([VOCA_BUDGET].[SUBGRANT_NO] = " & Me.SubgNo & ") And ([VOCA_BUDGET].[Budget_ID] = " & Me.BudgetID & ")"), 0) - ([FedFSRToDate]) < -500 Then MsgBox "Overspendi ng " & vbCrLf & vbCrLf & Me.Category & vbCrLf & vbCrLf & "by more than $500", vbExclamation
any help?
"jwa6" <jw*****@yahoo. com> wrote in message
news:11******** **************@ f14g2000cwb.goo glegroups.com.. . syntax for a dlookup ok I give up!
here is the error... ' Run-time error 3075 Syntax error in query expression '...'
this is the code before that a contractor wrote. (I dont know if it ever worked....the table was wrong however)
If Nz(DLookup("Fed Budget", "tblBudget" , "([SubgNo] = " & Me.SubgNo & ") And ([BudgetID] = " & Me.BudgetID & ")"), 0) - ([FedFSRToDate]) < -500 Then
' MsgBox "Overspendi ng " & vbCrLf & vbCrLf & Me.Category & vbCrLf & vbCrLf & "by more than $500", vbExclamation
this is the code I put in causing and error.
If Nz(DLookup("[BUDGET_FEDERAL]", "[VOCA_BUDGET]", "([VOCA_BUDGET].[SUBGRANT_NO] = " & Me.SubgNo & ") And ([VOCA_BUDGET].[Budget_ID] = " & Me.BudgetID & ")"), 0) - ([FedFSRToDate]) < -500 Then MsgBox "Overspendi ng " & vbCrLf & vbCrLf & Me.Category & vbCrLf & vbCrLf & "by more than $500", vbExclamation
any help?
Why not break it up into manageable bits and use variables to hold certain
bits of data. For example, you could dimension strWhere as a string to hold
the WHERE clause for the DLookup you could build this up in bits and do a
Debug.Print of it to check it is as expected. Also dimension something to
hold FedFSRToDate - whatever this is - a field from a bound form?
To put the whole lot in effectively one line of code is, as you have found
out, asking for trouble. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Tony Ciconte |
last post by:
I am using Acc97 and trying to get the following instruction to work
in the OnOpen event of a report:
DLookup("", "tblTempRevenueByFY", DatePart("m", ) =
1)
The table tblTempRevenueByFY exists, with data, as do the fields
"GiftAmt" and "GiftDate". However, when I try to preview the report, I
get 2465 error that says it cannot find the field "GiftDate". I have
tried every combination of quotes, double-quotes, parentheses, etc.
|
by: Tony |
last post by:
Hi,
I have a table with two primary keys as below.
Table: Mouse
Primary key 1: MouseLine
Primary key 2: MouseNumber
Field 3: DateOfBirth
In a particular form, if I know MouseLine and MouseNumber, can I use
|
by: shifty shaker |
last post by:
I've modified sql text and now i'm getting a syntax error that I cannot
figure out....anyone?
error occurs at the Insert Into line but the entire function is given in
case you need it.
---
Function ThisIs()
Dim TDate As Date, C1 As Integer, StrSQL As String, TypeAttend, RecDetect
If Not IsNull(Me.scrStudent) Then
C1 = 1: TDate = Me!
|
by: Diana |
last post by:
I thought I had this process pretty well down pat, but I'm getting a
syntax error on the following code:
*****Code*****
'Check for users - can't get this to work...
Dim strUser As String
strUser = WUserName()
If IsNull(DLookup("Permitted", "tblUsers", "Permitted = '" &
|
by: MLH |
last post by:
If Not IsNull(DLookup("", "tblCars", "=GetCurrVID()")) Then
If DLookup("", "tblCars", "=GetCurrVID()") Then
Of the above 2 syntax variations, is the 2nd unacceptable? I use the
former because I seem to remember suggestions in this forum that
discouraged the latter. But I tire of it. To me, the latter is more
readily understood because there's no double negative to deal with.
| |
by: Eric |
last post by:
Can any one please tell me the syntax is correct
Me.List17=DLookUp(,,="" And =")
Thanks,
|
by: injanib via AccessMonster.com |
last post by:
Hello Access Monsters,
I have a table with three columns. "CostCenter", "ProjectNumber", "GLCode"
On my form I have three texboxes, "txtCostCenter", "txtProjectNumber" and
"txtGLCode".
the AfterUpdate event of the txtCostCenter runs the following code.
Me.txtProjectNumber = DLookup("ProjectNumber", "tblList", "CostCenter =" & Me.
txtCostCenter)
Me.txtGLCode = DLookup("GLCode", "tblList", "CostCenter =" & Me.txtCostCenter)
|
by: Bhujanga |
last post by:
I have a form called BasicInfo.
On the form there is a field called text box called "County Name" and a ComboBox called "County Code"
There is a table called "CountyCodes" that has two fields; they are "County Code" and "County Name"
The combo box allows you to pick a county from a list tied to the "County Codes" table, and stores the "County Code" in the ComboBox field.
I want it to then automatically put the county name into the "County...
|
by: rolltide |
last post by:
I've seen many similar threads, but despite repeated efforts I cannot figure out my problem. I am running Access 2003, VB 6.5, Office XP Pro. Code excerpt is below (you can see where I've tried debugging myself). My problem is in the DLookup command.
UserName = Me.cboUserName.Value
Debug.Print "User Name is "; UserName
strPassword = DLookup("Password", "Employees", "EmpName ='" & UserName)
Debug.Print "Password is ";...
|
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |