|
-
Sep 14th, 2005, 02:49 PM
#1
Thread Starter
Junior Member
record source problem
no i'm sick of this
i spent whole afternoon searching the web and this forum for my answer
which i had and would have it but that jerk had to format the memory stick
grrrrrrrrrrrrrrrrrrrrrrrrrr
so here is the problem after a long brake of doing nothing i decided to make db app
now i remeber that i once found on the web something like this
adodc1.recordsource = "select * from and i do not know the rest
i found on this forum some topics with similiar code but it doesn't work and it is always .Open not .recordsource
i'm not some expert i'm just a kid (15 yrs) and really bad amateur
i want to find recordset in db using string in lets say Text1.text
by using code i found on the forum i would end up with this stupid err
Syntax error in FROM clouse
the code i'm using
VB Code:
Adodc1.RecordSource = "select ime " & _
"from baza where " & _
"ime= '" + Text4.Text + "'"
Adodc1.Refresh
Skipper, shall we tell them that the boat is out of gas!
Nah just smile and wave boys, just smile and wave!!!!!!!
-
Sep 14th, 2005, 02:54 PM
#2
Re: record source problem
 Originally Posted by tyrant
no i'm sick of this
i spent whole afternoon searching the web and this forum for my answer
which i had and would have it but that jerk had to format the memory stick
grrrrrrrrrrrrrrrrrrrrrrrrrr
so here is the problem after a long brake of doing nothing i decided to make db app
now i remeber that i once found on the web something like this
adodc1.recordsource = "select * from and i do not know the rest
i found on this forum some topics with similiar code but it doesn't work and it is always .Open not .recordsource
i'm not some expert i'm just a kid (15 yrs) and really bad amateur
i want to find recordset in db using string in lets say Text1.text
by using code i found on the forum i would end up with this stupid err
Syntax error in FROM clouse
the code i'm using
VB Code:
Adodc1.RecordSource = "select ime " & _
"from baza where " & _
"ime= '" + Text4.Text + "'"
Adodc1.Refresh
Take a look at the ADO examples in my signature.
Regards,
Mark
Please remember to rate posts! Rate any post you find helpful. Use the link to the left - "Rate this Post". Please use [highlight='vb'] your code goes in here [/highlight] tags when posting code. When a question you asked has been resolved, please go to the top of the original post and click "Thread Tools" then select "Mark Thread Resolved."
-
Sep 14th, 2005, 02:57 PM
#3
Re: record source problem
its your SELECT Statement
if you have that short of a line u dont really need to split it (but u can if u want)
Adodc1.RecordSource = "select ime from baza where ime= '" & Text4.Text & "'"
changed + to &
+ adds.. & concats
when combinig strings always use &
JPnyc rocks!! (Just ask him!)
If u have your answer please go to the thread tools and click "Mark Thread Resolved"
-
Sep 14th, 2005, 03:01 PM
#4
Re: record source problem
I'm afraid you are mixing things up.
addoc1.recordsource is a connection made in designtime to populate a form with records from a recordset. The parameters fot the connection are set at design time and the form is called a BoundForm. Controls on the form can use this data source to display 1 or more fields from the addoc1.recordsource.
The data shown is the data from the current record. moving up or down the recordset will trigger displaying the new data on the form.
So re-using the addoc1 connection to use a diffrent datasource would require building it at design time at the first place.
 why can't programmers keep and 31 Oct and 25 dec apart. Why Rating is Useful
for every question you ask provide an answer on another thread.
-
Sep 14th, 2005, 03:28 PM
#5
Thread Starter
Junior Member
Re: record source problem
@ [A51g]Static
doesn't work
still
Syntax error in FROM clouse
Skipper, shall we tell them that the boat is out of gas!
Nah just smile and wave boys, just smile and wave!!!!!!!
-
Sep 14th, 2005, 03:34 PM
#6
Re: record source problem
do a Debug.Print Adodc1.RecordSource
to see how it looks "for real"
(UT Player?)
JPnyc rocks!! (Just ask him!)
If u have your answer please go to the thread tools and click "Mark Thread Resolved"
-
Sep 14th, 2005, 03:45 PM
#7
Thread Starter
Junior Member
Re: record source problem
yes i'm an ut player
about debug errrrrr
where to put it
btw after
Syntax error in FROM clouse Error
goes another one Runtime Error then a bunch of numbers and the Automation error
Skipper, shall we tell them that the boat is out of gas!
Nah just smile and wave boys, just smile and wave!!!!!!!
-
Sep 14th, 2005, 03:50 PM
#8
Re: record source problem
put the Debug.Print Adodc1.RecordSource
right after you set Adodc1.RecordSource = "Select etc...
then Open the Immediate Window (Debug Window)after you run it
(Cant wait for UT07 looks incredible! Been hooked on BF2 lately.. very fun)
JPnyc rocks!! (Just ask him!)
If u have your answer please go to the thread tools and click "Mark Thread Resolved"
-
Sep 14th, 2005, 04:02 PM
#9
Thread Starter
Junior Member
Re: record source problem
(aaaaahhhhhh playing anything on line beyond starcraft and warcraft is my dream bcs of two reasons:
-i'm still on 56 k(hopefully adsl 384/128 in a month)
-99 % of gamers here use illegal copy-s(i saving every lipa(eg. peny) for original bf2 then it is just too xpensive for gamers here bcs living standard ia waaaaaaaaay below american))
aha here it is
Method refresh of object IAdodc failed
(i just hope that ut07 will run at least at minimal details and resulotion on this config:
a64 3000+ vencie @ 1,8 ghz
2 x 1gb ram ddr 400 by Super Talent
gygabyte nx66t128 vp (6600gt @ 550/1180 @ 128 mb)
i pray (to someone not god) every evning that it works on my machine(i do not bealeve in god))
(btw how's my english, i'v always wondered is it understandable to you from usa and gb)
Skipper, shall we tell them that the boat is out of gas!
Nah just smile and wave boys, just smile and wave!!!!!!!
-
Sep 14th, 2005, 10:22 PM
#10
Re: record source problem
well
first of all Your english is really good!! I did not even realize you were from Croatia!!
second...UT07 .. if it does not run on that system.. I would be mad.. thats a nice system
third... so the refresh is causing the problem...
what if you try to do this without the control?
create a new ADODB connection
and do a recordset open with that SQL...
see how that works
JPnyc rocks!! (Just ask him!)
If u have your answer please go to the thread tools and click "Mark Thread Resolved"
-
Sep 15th, 2005, 10:04 AM
#11
Thread Starter
Junior Member
Re: record source problem
damn it i tried with old sql but it doesn't work
so i'm using this(still ain't working)
i found it in old vb book that i dug up from my "ready for fireplace" bunch
VB Code:
Dim veza As New ADODB.Connection
Dim rs As New ADODB.Recordset
veza.Open Adodc1.ConnectionString
rs.Open "select * from baza where ime= " + Text4.Text, veza, adOpenDynamic, adLockReadOnly, -1
[offtopic]
1.nice to know( here in balkanian subcontinent(i think that is the expresion for piece of land surounded with sea from three sides) most of people think that americans and other western country citizens never heard of croatia,serbia and montenegro,bosnia and herzegovina,slovenia etc..., well infact when i think it over it is a lie(bcs u must have heard of us from our wars '90 and new one with usa(there was no reason for that) in '99 in both wars i lost a close person, most of the people in the serbia lost someone during '99 and most of them wouldn't great any american or anyone from NATO with open hands , ok the exception are stupid politicans)
2.yes it would be very stupid
[/offtopic]
Last edited by tyrant; Sep 15th, 2005 at 10:26 AM.
Skipper, shall we tell them that the boat is out of gas!
Nah just smile and wave boys, just smile and wave!!!!!!!
-
Sep 15th, 2005, 10:41 AM
#12
Re: record source problem
You need to build the Connection string
Do a search.. you should find enough info on it...
JPnyc rocks!! (Just ask him!)
If u have your answer please go to the thread tools and click "Mark Thread Resolved"
-
Sep 15th, 2005, 11:19 AM
#13
Re: record source problem
 Originally Posted by [A51g]Static
You need to build the Connection string
Do a search.. you should find enough info on it...
I'm a search and I have been done. 
VB Code:
Dim ADOCn As ADODB.Connection
Dim ConnString As String
Dim adoRS As ADODB.Recordset
Dim sSQL As String
ConnString = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=c:\yourdbname.mdb;" & _
"Persist Security Info=False"
Set ADOCn = New ADODB.Connection
ADOCn.ConnectionString = ConnString
ADOCn.Open ConnString
Set adoRS = New ADODB.Recordset
sSQL = "SELECT * FROM baza WHERE ime = '" & Text4.Text & "' "
adoRS.Open sSQL, ADOCn
'I have no idea what you want to do with the recordset
'but whatever it is, you would do it here.
adoRS.Close
ADOCn.Close
Set ADOCn = Nothing
Set adoRS = Nothing
-
Sep 15th, 2005, 11:56 AM
#14
Re: record source problem
I'm a search and I have been done
Huh!??
JPnyc rocks!! (Just ask him!)
If u have your answer please go to the thread tools and click "Mark Thread Resolved"
-
Sep 15th, 2005, 11:59 AM
#15
Thread Starter
Junior Member
Re: record source problem
i don't know *** does this means
No value given for one or more parameters.
@hack
i think i said it
i want to when i enter the name in ime textbox and press certain command button, to show me recordset matching that name
Skipper, shall we tell them that the boat is out of gas!
Nah just smile and wave boys, just smile and wave!!!!!!!
-
Sep 15th, 2005, 09:00 PM
#16
Re: record source problem
Could you post your code? Have you edited the example Hack has shown?
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
|