Right, well on many occasions i have accessed databases fine, but this occasion it wont work. Please can i have an example of accessing a database, with SQL based on a query.
I am sure i can fill in the gaps.
Thank You
ILMV
Printable View
Right, well on many occasions i have accessed databases fine, but this occasion it wont work. Please can i have an example of accessing a database, with SQL based on a query.
I am sure i can fill in the gaps.
Thank You
ILMV
Check out the tutorials in the Database forum.
http://www.vbforums.com/showthread.php?t=81916
Cheers
No No Help? :(
Exactly what sort of help do you need? Are you using DAO or ADO?
Post the code you're having trouble with or give me some specifics and I'll try and knock something together for you.
What exactly would that mean? Can you show us some code of yours that "won't work", please.Quote:
Originally Posted by I_Love_My_Vans
We really can't guess what exactly you are having trouble with, it would be better if you post your code where the problem is existing or be more elaborative on explaining it. :)
What kind of database?
Access
SQL Server
Oracle
?
Sorry everyone.
Right well i am using MS Access witd DAO...
here is the code i have used so far, but it doesnt seem to find the record...
Code to access record
VB Code:
SQLTXT = "SELECT Date, Subject, Entry" SQLTXT = SQLTXT + " From Entry" SQLTXT = SQLTXT + " WHERE Date = " & DatePicker.value Set MySearch = MyDatabase.OpenRecordset(SQLTXT) txtSubject.Text = MySearch!Subject txtEntry.Text = MySearch!Entry
All variables are definetly defined, and the database has def been loaded.
Thank you
Ben @k@ ILMV
Date is a keyword, surround it with square brackets. When a date value is used as a criteria it must be delimited by the # sign. To avoid other trouble, always use one of these date formats mm/dd/yyyy (Microsoft database standard), yyyymmdd (ISO standard) or a non ambiguous format such as dd-MMM-yyyy, when concatenating date values to a string. Also, get into the habit of using the & to concatenate strings.
VB Code:
SQLTXT = "SELECT [Date], Subject, Entry" SQLTXT = SQLTXT & " From Entry" SQLTXT = SQLTXT & " WHERE [Date] = #" & Format$(DatePicker.value,"mm/dd/yyyy") & "#"
Oh my god i love you!!!
Um, sorry.
Cheers buddy, good effort.
ILMV