Search : in
By :

Linking visual basic to msaccess

Last answer on Jul 18, 2009 3:35:52 am BST annie, on Mar 10, 2009 9:40:28 am GMT 
 Report this message to moderators

Hello,
plzzz twll me linking with visual basic to msaccess with coding........

Configuration: Windows XP
Firefox 3.0.6

Best answers for « linking visual basic to msaccess » in :
Starting with visual basic ShowStarting with visual basic Visual Basic is a programming tool designed by Microsoft for its Component Object Model (COM). This tool can be used to create applications for windows, web, mobile devices etc.The latest version of Visual basic...
System error: Microsoft Visual Basic ShowSystem error: Microsoft Visual Basic When opening Excel, you encounter the following error message. A window called "Microsoft Visual Basic" opens with the following contents: System Error & H80004005 (-2147467259). Unspecified error...
[Myth] Visual Basic is an object-oriented language Show[Myth]Visual Basic is an object-oriented language Myth Reality Explanations Myth Visual Basic is an object-oriented language. Reality FALSE. Explanations This myth is popular, but unfortunately its false: VB6 is not an object...
Databases - Using forms ShowUsing forms In order to use databases, the user must be provided with an interface that allows him or her to view data based on certain criteria. There is a tool for this: forms. A form is an interface with components for displaying, entering, or...
Worksheet - Cells ShowThe Concept of a Cell A "cell" is the intersection between a line (horizontal) and a column (vertical) on a worksheet. Thus, the name of the line combined with the name of the column gives the cell's coordinates (the term address is sometimes also...

1

Catgurl323, on Mar 11, 2009 8:26:10 am GMT
  • +6

Try this:

Option Explicit
Dim conn As ADODB.Connection, rec As ADODB.Recordset
Dim esql As String, esql2 As String, searchvar As String
Private Sub Command1_Click()
Text1 = ""
Text2 = ""
Text3 = ""
Command4.Visible = True
Command1.Visible = False
Text1.SetFocus
End Sub

Private Sub Command2_Click()
If Not rec.EOF Then
rec.MoveNext
Else
rec.MoveLast
End If
GetText
End Sub

Private Sub Command3_Click()
If Not rec.BOF Then
rec.MovePrevious
Else
rec.MoveFirst
End If
GetText
End Sub

Private Sub Command4_Click()
On Error GoTo 1
If Text1 = "" Or Text2 = "" Then
Command4.Visible = False
Command1.Visible = True
Exit Sub
End If
rec.AddNew
rec.Fields(0) = Text1
rec.Fields(1) = Text2
rec.Fields(2) = Text3
rec.Update
If Not rec.EOF Then rec.MoveNext
rec.MoveFirst
GetText
Command4.Visible = False
Command1.Visible = True
Exit Sub
1
MsgBox ("duplicate value") & Text3
End Sub


Private Sub Command5_Click()
Text1 = ""
Text2 = ""
Text3 = ""
searchvar = InputBox("enter item to find")
rec.Close
rec.Open ("select * from TestRavi where First=" & "'" & searchvar & "'"), conn, adOpenStatic, adLockReadOnly
If rec.Fields(0) <> "" Then
Text1 = rec.Fields(0)
Text2 = rec.Fields(1)
Text3 = rec.Fields(2)
Else
MsgBox ("No matching records found")
rec.Close
rec.Open ("select * from testravi"), conn, adOpenDynamic, adLockOptimistic
GetText
End If
End Sub
'for integers use
'Dim searchvar2 As Integer
'searchvar2 = InputBox("enter Number")
'rec.Open ("select * from TestRavi where First=" & searchvar2), conn, adOpenStatic, adLockReadOnly
Private Sub Form_Load()
Set conn = New ADODB.Connection
Set rec = New ADODB.Recordset
'conn.Open ("Provider=Microsoft.Jet.OLEDB 4.0;Data Source=C:\Program Files\Microsoft Office\Office\Samples\Northwind.mdb;Persist Security Info=False")
conn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Program Files\Microsoft Office\Office\Samples\Northwind.mdb;Persist Security Info=False"
conn.Open
esql = "select * from TestRavi"
rec.Open (esql), conn, adOpenDynamic, adLockOptimistic
GetText
End Sub

Private Sub Form_Unload(Cancel As Integer)
rec.Close
conn.Close
Set conn = Nothing
command1.visible=false
End Sub
Private Sub GetText()
If rec.BOF = True Or rec.EOF = True Then Exit Sub
Text1 = rec.Fields(0)
Text2 = rec.Fields(1)
Text3 = ""
End Sub

Reply to Catgurl323

4

 just asking, on Jul 18, 2009 3:35:52 am BST
  • +2

What about for Visual Basic 2008??

tnx, i need hellpppp

Reply to just asking

2

nomadcrys, on Mar 12, 2009 8:52:40 am GMT
  • +1

Where did you get that solution?

Reply to nomadcrys

3

akangcupez, on Jul 4, 2009 3:19:20 pm BST

http://www.free-tutorial.webs.com/ .contains free VB NET tutorial

Reply to akangcupez