473,800 Members | 2,497 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Very basic code help

46 New Member
New to visual basic; trying to teach myself. Here is very basic code I am using to try to fill a text box on my form after updating a box that selects an employee ID.

Expand|Select|Wrap|Line Numbers
  1. Dim strsql As String
  2. strsql = "SELECT Wage FROM Employees WHERE NameID = " & Me.EmpNameID
  3. Me.Wage = strsql
However, when updated, the text just shows up in the box as opposed to looking up the wage. What am I doing wrong?

Thank you!
Dec 17 '07 #1
3 1257
missinglinq
3,532 Recognized Expert Specialist
Assuming that NameID is numeric, which your code indicates, why not simply use DLookup()?

Expand|Select|Wrap|Line Numbers
  1. Me.Wage = DLookup("Wage", "Employees", "[NameID] = " & Me.EmpNameID)
If NameID is Text rather than Numeric

Expand|Select|Wrap|Line Numbers
  1. Me.Wage = DLookup("Wage", "Employees", "[NameID] = '" & Me.EmpNameID & "'")
  2.  
Linq ;0)>
Dec 17 '07 #2
bbatson
46 New Member
Perfect - never heard of that. Thank you very much.
Dec 17 '07 #3
missinglinq
3,532 Recognized Expert Specialist
DLookup works fine when retrieving a single field value.

Glad we could help!

Linq ;0)>
Dec 17 '07 #4

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

Similar topics

42
9752
by: Steven O. | last post by:
I am seeking some kind of tool that I can use for GUI prototyping. I know how to use Visual Basic, but since a lot of software is being coded in Java or C++, I'd like to learn a Java or C++ -based tool. Back when I took my Java and C++ classes (two or three years ago), the available tools -- at least the ones I could find -- were still not as easy, not as "drag-and-drop", as Visual Basic. Has that changed? Is there some software out...
5
1495
by: hellrazor | last post by:
Hi there, First of all, I'm very much a C++ amateur (i.e., a newb). I'm having to program a win32 system service for my employer, and I'm almost done with the task, but I need help with something that appears to be very basic. I have a function within the cpp file called StopService: void StopService() {
5
5715
by: Lee David | last post by:
I went to the sun site and downloaded what I hope is the development part of java. I downloaded JDK5 with Netbeans. I installed it and now have a folder in my program group "Netbeans". Is that java? Would I execute that to create a java application? TIA, Lee
10
1870
by: Jason Curl | last post by:
Greetings, I have an array of 32 values. This makes it extremely fast to access elements in this array based on an index provided by a separate enum. This array is defined of type "unsigned long int". I have a typedef for this: typedef unsigned long int Uint32; typedef float Float32; Uint32 myArray;
5
8837
by: me | last post by:
Hi can anyone one help me? i want to write a very small basic interpreter in c. is there any source to analize in the internet or theory? Thanks
8
1645
by: pamelafluente | last post by:
Hi, I would like to get some advice. I know enough vb.net on win apps, but I have never worked on web applications and asp.net. I would appreciate if you could indicate the most basic tutorials where to start my journey with ASp net.
7
1291
by: Bruno43 | last post by:
Hi I am trying to learn Visual Basic and I am getting everything for the most part, mainly because of my ability to read code like a book, but my question is what is the best way to Navigate through a Visual Basic program. For example lets say I have a big Visual Basic Form1.vb and on Form1.vb there are buttons and I click on this button, now the only thing I want to change would be a "content" area, I want the navigation to be the same. ...
1
204
by: Rik Wasmus | last post by:
On Tue, 17 Jun 2008 00:52:16 +0200, Twayne <nobody@devnull.spamcop.net> wrote: Euhm, no you can't. The only thing remotely close is something like: echo 'foo','bar'; .... which is nothing like concatenation at all.
3
1185
by: ellishnoo | last post by:
Hi there, Please be kind, I have seen some posts where you tell people off for asking without investigating, Im sure most have, anyway I have. Ive only been doin VB 2008 for 7 weeks, and have been told at college to make 5 statges/wizards of login forms, Ive done the design easy... What I need help with is the next and back button, after many,many,many,many hours of searchin I worked out next botton for a button in response to a list of...
0
9691
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, 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...
0
10279
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10255
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,...
0
9092
agi2029
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...
1
7582
isladogs
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...
0
6815
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();...
0
5607
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4150
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
3
2948
bsmnconsultancy
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...

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.