|
-
Apr 11th, 2004, 08:38 AM
#1
Thread Starter
Junior Member
Syntax error VB6 & Jet4 Database
Hi,
This is my first time at VB Forums.
I think this is the correct area for posting coding questions.
If it is not, please let me know.
Question:
I have been building a VB6 application with Jet 4 Microsoft Data Base for tracking investments.
Since I am relatively new to VB I continue to have difficulty with the syntax.
The following code generates a syntax error when I run the application.
adoTrackInvest.RecordSource = "SELECT Invested FROM History WHERE Date >= # " & txtTrackingDate & " # AND Investor_Number = " & frmStartPage.txtInvestorNumber & " AND Value = " & txtHiVal & "'"
adoTrackInvest.Refresh
What is puzzeling to me is that the Error Message Box that warns of the syntax error seems to be able to draw the required info from the text boxes.
The message I get is:
Syntax error in query expression 'Date>= #4/3/2004# AND Investor_Number = 5 AND Value = $29,697.00".
All these values are correct.
Any help on this will be greatly appreciated.
Thanks,
Dwight
This has been resolved.
Many thanks to ae_jester
I formatted the text to numeric with no commas and attached the ado to a variable then re formatted for currency.
Works great.
Many thankful regards,
Dwight
Last edited by DK47; Apr 13th, 2004 at 06:13 PM.
-
Apr 12th, 2004, 08:08 PM
#2
Welcome to the forums.
Make sure Investor_Number is a numeric field type and that you
format the Value textbox to not contain the $ symbol and the
comma. Access thinks the comma is separating a field in the
where clause and that field has no name.
Ex. "...AND Value = $29, AND ??? = 697.00".
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 
-
Apr 13th, 2004, 06:15 PM
#3
Thread Starter
Junior Member
RobDog'
Thanks very much.
DK
-
Apr 13th, 2004, 06:17 PM
#4
You can keep the formatting in the textbox, but when you get
ready to submit your sql, format the value so it doesn't have it.
Glad to help.
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
|