in visual basic 6
i have on table contain many rows.
I used "LIKE" operator to search by employee name :
Adodc1.RecordSource = "SELECT ...... where T_Deductions_Collection.Employee_Name LIKE '%" & Text5 & "%' and ..... "
I want to change the search technique to be by employee_ID instead of employee_name, knowing that the employee ID number consists only of numbers.
What is the appropriate code

rproffitt commented: I found VB6 and the usual SQL to flat out be unsupportable years ago. Move on! +16

Recommended Answers

All 3 Replies

Adodc1.RecordSource = "SELECT ... FROM T_Deductions_Collection WHERE Employee_ID = " & Val(Text5.Text) & " AND ..."

Why are you using RecordSource instead of Adodc1.Open?

For numeric fields you might want to use the BETWEEN keyword, assuming you are restricting to a range of values. But VB6? Seriously?

There is a massive amount of VB6 code still running in production today, which is exactly why Microsoft continues to ship the VB6 runtime, core COM components, and legacy OCX controls with Windows 11 and Windows Server. The IDE is long out of support, but the runtime remains part of Microsoft’s long‑term Windows compatibility strategy.

VB6 persists because it’s embedded in places where stability matters more than fashion: banks, insurance, manufacturing, government systems, medical devices, embedded systems, and internal enterprise tools. These systems work, and rewriting them would be expensive, risky, and offer little to no benefit.

No one is claiming VB6 is the wisest choice for new commercial development today. But it’s impossible to ignore that VB6’s RAD model was mass‑adopted, extremely productive, and remains surprisingly capable. I’m consistently impressed by the creativity and technical depth shown by VBForum hobbyists. Did VB6 encourage or allow some bad habits and sloppy code? Sure — but the surprising truth is that much of that “slop” has been running in production for decades.

VB6 isn’t “dead.” It’s legacy — and legacy that still runs.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.