473,503 Members | 1,656 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Filling in Textboxes with a specific value from a specific record in a specific table.

Hello,

I've been waisting tons of time on this, so I'll just ask and
hopefully someone will be able to help.

I am opening an excel document and placing values into it's
"letterhead" section (i have no problem doing this).

The values that I am writing to the excel document come from a couple
different tables.

I am displaying the set of values on a form for the user to see. once
they approve and click a button, the code takes those values in the
textboxes and writes them to the excel document.

I have not set the recordsource property for the form, cause its not
like its actually updating any records or anything, but I am having
difficulty running simple select queries for the textboxes. I have
been trying to specify a query in the Control Source, but that is
wrong.

So, in summary, I would like to know how to associate a SELECT query
to a textbox on a form with no record source.

Any suggestions would be greatly apprechiated!

Thanks,
Dave
Nov 12 '05 #1
1 2370
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

You could also create a query that gets all the data from the
different tables you want and set the Form's RecordSource property to
that query. Then just bind the controls to the columns in the query.

==

[Unbound form]

You could have a function in each Controls' ControlSource that returns
the results of the SQL statement. E.g.:

ControlSource: =GetDate()

And the function:

== air code ==

Function GetDate()

Dim strSQL As String
strSQL = "SELECT InvDate FROM Invoices " & _
"WHERE OrderDate = Date() AND OrderID = " & Me!txtID

Dim db As DAO.Database
Dim rs AS DAO.Recordset
Set db = CurrentDB
Set rs = db.OpenRecordset(strSQL)
GetDate = rs(0)

rs.Close
db.Close

End Function

== end air code ==

You'd need to make separate functions for each Control.

You could also use the domain function DLookup(), which is slower than
a recordset retrieval.

HTH,

MGFoster:::mgf
Oakland, CA (USA)
-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv

iQA/AwUBP7lsXYechKqOuFEgEQIdTQCff+Wrye6bMaifywAXgQ7pHu PfDakAoNS7
va3SWUw+CxenNcWDWIpoQRWc
=uCTm
-----END PGP SIGNATURE-----

Dave wrote:
Hello,

I've been waisting tons of time on this, so I'll just ask and
hopefully someone will be able to help.

I am opening an excel document and placing values into it's
"letterhead" section (i have no problem doing this).

The values that I am writing to the excel document come from a couple
different tables.

I am displaying the set of values on a form for the user to see. once
they approve and click a button, the code takes those values in the
textboxes and writes them to the excel document.

I have not set the recordsource property for the form, cause its not
like its actually updating any records or anything, but I am having
difficulty running simple select queries for the textboxes. I have
been trying to specify a query in the Control Source, but that is
wrong.

So, in summary, I would like to know how to associate a SELECT query
to a textbox on a form with no record source.

Any suggestions would be greatly apprechiated!

Thanks,
Dave

Nov 12 '05 #2

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

Similar topics

1
1510
by: Marcel Linnenfelser | last post by:
Hi, how can I get the number of data sets with a specific value for a whole table? I want to have a statement that gives me a result set where each data set tells me the value and the count of...
1
1852
by: hriceb | last post by:
I know about the SendObject command but I think my question is a bit different. I have TableA that includes FName, LName, etc... and EMail. Generally, data is entered / changed via FormA I...
0
1656
by: Mark | last post by:
Hi All, Win XP, Office XP What I am trying to do is create a login form. The problem is that I am going to set the database up using Access security so that only admin users can read the...
0
2409
by: Mark | last post by:
All, Excuse the re-post but I have found something which works for the UserID but not for the Password (see previous post below). The problem is I don't understand how it works and therefore...
0
1198
by: Johann Blake | last post by:
I have a dataset that I bind to two different datagrids. The dataset contains 2 tables. One is the main table used to store what I call session data which includes a Country field where the ID of a...
1
1860
by: gaurkamal | last post by:
I want to delete record in table B when i delete record in Table A both table have a common column. I want to do it using trigger .Can any body give some idea. Table details are. Table A: ...
5
1980
by: MrMob | last post by:
I would like to update thousand of Rows with its specific value Suppose i have a table XYZ and ABC XYZ contains Code,Name,RegDate And ABC also Contains the same but the Value of RegDate of XYZ...
3
2102
by: debo sniffa | last post by:
I want to add a value from a record in Table A to a record in table B if the value is same as 2 other fields in the Table A. How could i get this done in access?? Pls help me... ;-)
0
1118
by: Neven Huynh | last post by:
Hi Everyone, Here i my LINQ query to get record in Table Menu with condition are parentID == 0(get root menu) and ID != (parentID list) (which is parent ID list is are id of menu record that have...
0
7198
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,...
0
7319
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...
0
5570
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,...
1
4998
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...
0
4666
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...
0
3160
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...
0
3149
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1498
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 ...
1
730
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.