|
-
Jan 3rd, 2005, 05:52 PM
#1
Thread Starter
Lively Member
Stupid Question... Sql and a text box...
Ok, I have a report in access that I am adding a text field to.
I have a select statement that returns one value.
I want that select statement to put the value into the text box.
I have been going crazy today figuring it out. All I get is #NAME?
Here is what the source is.
= (Select Top 1 NumAdj From TblName) Thats all. Once I get that to return something, Then I can add a where clause.
Thanks.
-
Jan 3rd, 2005, 09:51 PM
#2
Junior Member
Re: Stupid Question... Sql and a text box...
= (Select Top 1 NumAdj From TblName)
is not proper VBA syntax fror a textbox ControlSource.
Try
="Select Top 1 NumAdj From TblName"
Alternatively, TblName is mispelled, or "NumAdj" is not a field in "TblName."
-
Jan 4th, 2005, 08:10 AM
#3
Thread Starter
Lively Member
Re: Stupid Question... Sql and a text box...
I guess this is more of an Access question than a VBA question. I am trying to get the sql statement in using the front in. (Properties Window) Anyone know if that is possible.
 Originally Posted by llkhoutx
is not proper VBA syntax fror a textbox ControlSource.
Try
="Select Top 1 NumAdj From TblName"
Alternatively, TblName is mispelled, or "NumAdj" is not a field in "TblName."
-
Jan 4th, 2005, 08:20 AM
#4
Frenzied Member
Re: Stupid Question... Sql and a text box...
 Originally Posted by wookie224
I guess this is more of an Access question than a VBA question. I am trying to get the sql statement in using the front in. (Properties Window) Anyone know if that is possible.
What does that mean? You could create the query in the query section of the database and set the control source to that.
Tengo mas preguntas que contestas
-
Jan 4th, 2005, 12:56 PM
#5
Re: Stupid Question... Sql and a text box...
For a report, you can only have one recordsource. From that recordsource
you can map textboxes to the rs' fields. You can not execute a select
statement on a report.
Is seems like you can do one of two things:
- Modify your reports reportsource to include the field you need by modifing
the query. - Add a sub-report with the sql statement as its recordsource and the
subform will have the textbox mapped to the field you need.
HTH
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|