Hi,
I have a test form with:
* textbox txtIXO_NR bound to column IXO_NR through the linked SQL Server 2005 table TXOCTC (link name "dbo_TXOCTC")
* an unbound textbox which should display the description of the value in the bound textbox using SELECT dbo_TXOBJCT.IXO_NA FROM dbo_TXOBJCT where dbo_TXOBJCT.IXO_NR = txtIXO_NR.Value; (I've tried different syntax to reference the value with no luck).
* an unbound textbox to display the value in the bound textbox using =txtIXO_NR.Value
When I type in the value in txtIXO_NR (e.g. 1) I get the #NAME? error in txtIXO_NA.
From what I found, the most common cause of this error is duplicate object names which, from what I can tell, is not an issue.
Any ideas ?
Thanks, Ed.
5 3148 Rabbit 12,516
Recognized Expert Moderator MVP
I don't think you can use a SQL statement as the control source or default value for a textbox. Look into the DLookup function.
Hi Rabbit,
Here's a couple of the ones I tried. They both generate a #NAME? error:
=DLookUp("IXO_NA","TXOBJCT","IXO_NR=" & [Me].[txtIXO_NR])
=DLookUp("dbo_TXOBJCT.IXO_NA","dbo_TXOBJCT","dbo_T XOBJCT.IXO_NR=" & [txtIXO_NR.Value])
=DLookUp("IXO_NA","dbo_TXOBJCT","IXO_NR=" & Me!txtIXO_NR.Value)
=DLookUp("IXO_NA","TXOBJCT","IXO_NR=" & Me![txtIXO_NR.Value])
This one generates an #ERROR:
=DLookUp("IXO_NA","TXOBJCT","IXO_NR=" & txtIXO_NR.Value)
=DLookUp("IXO_NA","TXOBJCT","IXO_NR=" & [txtIXO_NR].[Value])
Based on what I was able to find, the only thing I can think of is that I'm referencing the textbox's value incorrectly or maybe it has something to do with using a linked table vs. local ?
Access is not my thing and I'm sorry to have to bother you with something that seems so simple yet is frustrating me to no end.....
Thanks !
Rabbit 12,516
Recognized Expert Moderator MVP
If txtIXO_NR is of data type string then you need to delimit it as such using quotes. - =DLookUp("IXO_NA","dbo_TXOBJCT","IXO_NR='" & Me.txtIXO_NR & "'")
Hi Rabbit,
I figured it out. Here's the code I added to the AfterUpdate event of the textbox txtIXO_NR:
Private Sub txtIXO_NR_AfterUpdate()
Dim IXOName As Variant
Me.txtIXO_NA = IXOName
If Not IsNull(Me.txtIXO_NR) Then
IXOName = DLookup("IXO_NA", "dbo_TXOBJCT", "IXO_NR = " & Me.IXO_NR)
Me.txtIXO_NA = IXOName
End If
End Sub
Thanks again for the help !
Ed.
Rabbit 12,516
Recognized Expert Moderator MVP
Glad you found a solution. The code is a bit inefficient but achieves what you want.
On another note, the DLookup should be: - =DLookUp("IXO_NA","dbo_TXOBJCT","IXO_NR=" & txtIXO_NR)
I keep forgetting you can't use Me outside of VBA code.
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Wayne Aprato |
last post by:
Can anyone please help me with the following madness in Access 2003
(2000 file format). I am using 2 similar funtions, the first which
works fine to save reports as snapshots:
On Error Resume...
|
by: Todd Perkins |
last post by:
Hello all, surprisingly enough, this is my first newsgroup post, I usually
rely on google. So I hope I have enough info contained. Thank you in
advance for any help!
Problem:
I am getting...
|
by: tshad |
last post by:
I am getting an error on a object name that doesn't exist (according to asp.net), but if you look at the trace, it does.
Here is the error:
...
|
by: mef526 |
last post by:
I would like to reference a dynamically created control and I know the name.
I would like to use the following:
Dim strName as String = "txtControl1"
' This is the ".Name" used when textbox was...
|
by: ST |
last post by:
Hello everyone, Can anyone help me with this error above when I debug my web
app project in vstudio.net?? I can't figure it out! It was working fine for
months, and now all of a sudden it's not!!...
| |
by: jzheng22 |
last post by:
Hi all,
I am new to VB .NET. I am currently wring a simple GUI, a TextBox
(multilined),
a button and an OpenFileDialog. When user click the button, the
OpenFileDialog
fired and after user...
|
by: preeti13 |
last post by:
Hi friends i have a probelm i am try to pass the value to the employeeid parameter but getting th error please help me how i can do this i am getting the error here is my code
using System;...
|
by: preeti13 |
last post by:
Hi guys i am here with my another probelm please help me.trying insert the value into the data base but getting the null value error .I am getting thsi error
Cannot insert the value NULL into...
|
by: John |
last post by:
I am looking for VBA code that will work with Access 2003 to enable
dragging and dropping a file/folder name from Windows XP Explorer into
an Access form's text box. This is a common functionality...
|
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...
|
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: 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...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
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,...
|
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...
|
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...
|
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...
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |