Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Search string

Status
Not open for further replies.

JanTore

Technical User
Jun 9, 2001
34
NO
Hi all,
I'm trying to get certain records from my database using an Inputbox. I.E. I type in the projectNR in the inputbox
I guess I dont have to tell I'm new to VB...

Private Sub Form_Load()
Dim db As Connection
Set db = New Connection
db.CursorLocation = adUseClient
db.Open "PROVIDER=Microsoft.Jet.OLEDB.3.51;Data Source=" & App.Path & "\MstrRUH1.mdb;"

Set adoPrimaryRS = New Recordset
adoPrimaryRS.Open "select ProjectNR,NestenUlykke,UønsketHendelse,FarligForhold, from RUH Order by ProjectNR", db, adOpenStatic, adLockOptimistic

Set grdDataGrid.DataSource = adoPrimaryRS


mbDataChanged = False
End Sub
 
this is how I do my database stuff. i'm not using Jet though..

'needed to open a database
Dim xconnection As New ADODB.Connection
Dim xrecord As New ADODB.Recordset

'sql statement
sql = "select * from " & "[" & Text4.Text & "]"

'open the table, giving the user name and password.
'must have ODBC connection

xconnection.Open "HL7 test", "john", "dictator"

'set the record
xrecord.Open sql, xconnection, adUseClient, adLockOptimistic


'to change the sql statement
sql = "select * from " something
xconnection.excute(sql)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top