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 = '" &
strUser & "'")) Then
MsgBox ("Sorry, " & strUser & " you do not have permission to
use this database")
DoCmd.Quit
End If
*************** ***
Here is what the error message looks like when it looks me up (dgard):
syntax error in string query expression 'Permitted = 'dgard'.
If I change strUser to "dgard", the query works properly, so I'm
guessing it has something to do with the user lookup process.
Here is the code for the WUserName() function:
******Code***** ****
Public Function WUserName() As String
On Error Resume Next
WUserName = " "
Dim strName As String
strName = Space(8)
Call GetUserName(str Name, 8)
WUserName = strName
End Function
Declare Function GetUserName _
Lib "advapi32.d ll" _
Alias "GetUserNam eA" _
(ByVal lpBuffer As String, _
nSize As Long) As Long
*************** *****
Any ideas would be of great help to me, thanks!
Diana 2 2948
"Diana" <di*******@yaho o.com> wrote in
news:11******** **************@ j52g2000cwj.goo glegroups.com: Here is the code for the WUserName() function:
******Code***** **** Public Function WUserName() As String On Error Resume Next WUserName = " " Dim strName As String strName = Space(8) Call GetUserName(str Name, 8)
The problem is in the line below: WUserName = strName
it's returning a string with the user name, a null and the rest
of the string.
this is the fix.
WUserName = Left(Trim((strN ame)), Len(Trim(strNam e)) - 1) Any ideas would be of great help to me, thanks!
Diana
--
Bob Quintal
PA is y I've altered my email address.
Thanks, so much, Bob! That solved it.
Diana
Bob Quintal wrote: "Diana" <di*******@yaho o.com> wrote in news:11******** **************@ j52g2000cwj.goo glegroups.com:
Here is the code for the WUserName() function:
******Code***** **** Public Function WUserName() As String On Error Resume Next WUserName = " " Dim strName As String strName = Space(8) Call GetUserName(str Name, 8)
The problem is in the line below: WUserName = strName it's returning a string with the user name, a null and the rest of the string.
this is the fix. WUserName = Left(Trim((strN ame)), Len(Trim(strNam e)) - 1) Any ideas would be of great help to me, thanks!
Diana
-- Bob Quintal
PA is y I've altered my email address. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Ronny Sigo |
last post by:
Hello all,
I want to perform a DLookup function with a variable (long) as critera.
I know if it was a string this would be the correct syntax :
Me!txtStad.Value = DLookup("", "tblPostnummers", " = '" &
sBoxvalue & "'")
Can anybody give me the correct syntax when boxvalue is a number (long) (In
that case it would be called nBoxvalue.
I don't seem to understand the delimiting :(:(:(
Any help appreciated ....
Thanks
|
by: Edward S |
last post by:
Friends, I had posted this on "Microsoft.Public.Access", But I did not
get a satisfactory response. I have been struggling for nearly 2 days
trying to crack this code. I really need help, could some one please
help me......
The Problem....
The USDollarAmt field is a calculated field, calculated
from the Original Currency Amount (OriginalCurrAmt) less the Disputed
Amount (DisputedAmtOCur) both from the table "TblInvoiceMain" and then...
|
by: jwa6 |
last post by:
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)
|
by: Thelma Lubkin |
last post by:
I am still struggling with trying to match a user supplied string with
strings in a field of a table, where spaces are to be ignored.
Arno suggested that I use the Dlookup function, but I apparently can't
get its syntax right.
Access gives me "Run-time error '2001' You canceled the previous operation"
url: http://www.fontstuff.com/access/acctut15.htm,
a set of 'Access Tips' has this to say about this error:
|
by: basstwo |
last post by:
I have a field with a serial number in it. I want to use Mid to
extract the 4th and 5th characters, use them to lookup a value on a
small lookup table, and use the info from that table to fill in the
value for my lens field. I tried doing this:
=DLookUp(!,,Mid(!,4,2)=!)
Where LensLookup is my lookup table, LensName is the value I want to
have appear
| |
by: MLH |
last post by:
DLookup("", "tblPreliminaryVINs",
"=Forms!frmVINODO!SerialNum")
is giving me a Type Mismatch error. That's confusing to me
and I don't know how to circumvent it. The field in
tblPreliminaryVINs is a 17-char text field. Forms!frmVINODO!SerialNum
is just an unbound textbox on a form (frmVINODO).
I run the DLookup during the textbox's BeforeUpdate event code. Some
VIN values I type in there do NOT give rise to the error. Some do. By
|
by: Don |
last post by:
Can someone help me fix my DLookup problem. I'm far from proficiency with
Access. I've been creating databases for several years for work with the
help of many of you and trial and error.
I have used DLookup several times and I've actually re-created the same
lookup just in different forms.
Here's my problem.
I'm using dlookup when I enter a part description it adds the part number
for me. I choose the part description from a combo...
|
by: Thelma Lubkin |
last post by:
I would like my DLookup criteria to say this: Trim(fieldX) = strVar:
myVar = _
DLookup("someField", "someTable", "Trim(fieldX) = '" & strVar & '")
I don't believe that this will work, and I won't be at a machine with
access to Access for a while, so can someone please tell me how to write
this?
thanks, --thelma
|
by: MLH |
last post by:
The following SQL returns PRECISELY what I want:
SELECT TOP 1 tblCorrespondence.CorrespID,
tblOutboundTypes.OTypDescription, tblCorrespondence.OutDate,
tblCorrespondence.VehicleJobID, tblCorrespondence.OutType
FROM tblOutboundTypes INNER JOIN tblCorrespondence ON
tblOutboundTypes.OutType = tblCorrespondence.OutType
WHERE (((tblCorrespondence.OutDate) Is Not Null) AND
((tblCorrespondence.VehicleJobID)=3))
ORDER BY...
|
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: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
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: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
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: 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...
| |