473,320 Members | 2,202 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

bound text boxes populated by a command button

I have a form with 3 BOUND text boxes.
box1
box2
box3

I want to have a comand button that populates those boxes when clicked.

The values are to be looked up via a corresponding product#.

I.E.

Product1 box1
Product2 box2
Product3 box3

So to find the value for each, there would be an SQL statement. I.E.
Use Product1 value to look up the value that is put in box1.....etc,
etc....
I think this will work, but am not quite sure how the code would go....

Any help would be appreciated.
Doug

Nov 13 '05 #1
1 1585
If this is a one-off kind of deal, I would look at the DLOOKUP function
in help. This is a very straight-forward way of pulling a vaule like
this, but it doesn't not work in every single situation. Otherwise,
you would build a SQL string something like this:

"SELECT T.ValueINeed FROM RelevantTable AS T WHERE
T.LookupField = " & value & ";"

(Note if the value variable is a string, surround it with the Chr(34)
function: ...& Chr(34) & value & Chr(34) ... Chr(34) returns a
quotation mark; if it's a date, use date literals '#')

Where value can be a control value, argument to a sub/function, etc.
Then base a recordset on the statement using DAO (Set recordset =
db.OpenRecordSet(strSQL)) and pull the value you need (me.box1 =
recordset.fields("ValueINeed")).

There is also a way to do this using DAO only (search help for the
findfirst method; there's a great example using the northwind
database).

Post back if you need more help with the code.

Johnny

Nov 13 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Paul Edwards | last post by:
I am writing in c# with Visual Studio 2003. I am creating a form that shows one record from a Dataset that is populated with only one record from SQL Server 2000. I am using bound controls, both...
2
by: CSDunn | last post by:
Hello, I have an MS Access 2003 Project form in which I need to set the value of a textbox named 'TestGrade' to the value present after the update of a combo box currently named 'Combo6'. The data...
4
by: vulcaned | last post by:
Hi All, Hopefully I explain this well........ In Access97 I have a form which has a tab control on it, each tab has a sub-form which is bound to its appropriate table(I'll call them 'Detail'...
8
by: Galina | last post by:
Hello I have 6 dependent list boxes on my ASP page:  Faculty;  Lecturer;  Course;  Course occurrence;  Group;  Week commencing date. When faculty is selected, lists of lecturers and...
6
by: Frank | last post by:
Hopefully this is the correct group for this message. My previous post to (I assume) a non-.net group was not welcomed. I have a form with 7 text boxes that are all bound to fields of a...
1
by: Aparna Rege | last post by:
Hi, I am having trouble with a tab control. All the fields on the form are data bound and are spread over two tabs of a tab control. I have placed a Clear button with the code to clear all the...
1
by: jasmith | last post by:
I can't seem to get this to work! Basically, I have filterd a dataview and have bound the text boxes on my form to the dataview: dvEqDetails.Table = dsUpdateEq.Tables("tblControlData")...
12
by: ljungers | last post by:
I'm on the home streach of my project and found that my "Reset for New Search" command button not working as desired. What should happen is that when the button is clicked a Event Procedure is run....
11
by: jwessner | last post by:
I have a form (Form1) which contains basic Project data and a subform listing the personnel assigned to the Project as a continuous form. Selecting a person on that project and clicking on a command...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

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.