|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
I have a database called eastwest.mdb . one of the table in database is named "tblpart" and it contains following fields.
recrdno (autonumber) partno(text) cavities(text) hits(text) I am trying to use following code to get data out of database if user enters partno and cavities and it's not working for me. can somebody point to me where's the mistake? thanks in advance Dim response As Integer Dim con_3 As New ADODB.Connection Dim rs As New ADODB.Recordset con_3.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\eastwest.mdb;Persist Security Info = false" rs.Open "Select * from tblpart where [partno] =' " & Trim(TxtPartNo.Text) & "' and [cavities] =' " & Trim(Text3.Text) & " ' ", con_3, adOpenKeyset, adCmdTable If rs.RecordCount > 0 Then response = MsgBox("Record already exists in database. Do you want to update it?", vbYesNo + vbQuestion, "Save Part no") If response = vbYes Then con_3.BeginTrans If Trim(Text1.Text) <> "" Then rs!costperlb = Text1.Text Else rs!costperlb = "1.00" End If rs!wghtper100 = Text2.Text rs!hits = Text4.Text rs!inspectionpcs = Text5.Text rs.Update con_3.CommitTrans rs.Close con_3.Close Exit Sub Else rs.Close con_3.Close Exit Sub End If end if Everty time I do that i get no data in my recordset. but if I simply use following code rs.Open "Select * from [tblpart]", con_3,adOpenKeyset, adCmdTable I get all the records in database in my recordset I did check all fields and their type and everything is correct. can anybody help? Thanks Again |
|
#2
|
||||
|
||||
|
try building the query to a string, printing the string to a message box so that you can see what it is, or use the debugger...
|
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > Visual Basic Programming > simple database question |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|