Re: record source problem
Quote:
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.
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 &
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.
Re: record source problem
@ [A51g]Static
doesn't work
still
Syntax error in FROM clouse
Re: record source problem
do a Debug.Print Adodc1.RecordSource
to see how it looks "for real"
(UT Player?)
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
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)
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)
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
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 :bigyello: , ok the exception are stupid politicans)
2.yes it would be very stupid
[/offtopic]
Re: record source problem
You need to build the Connection string
Do a search.. you should find enough info on it...
Re: record source problem
Quote:
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. :D
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
Re: record source problem
Quote:
I'm a search and I have been done
Huh!??
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
Re: record source problem
Could you post your code? Have you edited the example Hack has shown?