Hi all,
I have this project to use the ADODB control to acces and manipulate the
Access DB. I amd the mistake of first doing this project with just the data
control. It worked fine with this control. I adjusted a few things and can
get the ADODB controlto move through the records of the DB, but my menu
controls do not work. I used them to look up certain records through
various criteria. When I click on the lookup, it brings up the box to enter
a letter to find the record but does not find the record and the ADODB
button becomes inactive. I left the button name as dtaAddress, but it is
really an adoAddress. Another funny thing is when I tried to chand the name
of dtaAddress to adoAdress the ADODB control would become inactive then. I
am now trying to get the menu control to work with ADODB I think it has to
do with th refresh method you see in my code, but when I try to change it to
requery, I get an error message. Any help would be greatly appreciated.
Regards,
Kelsey
Option Explicit
Private conn As ADODB.Connectio n
Private rs As ADODB.Recordset
Private Sub Command1_Click( )
End Sub
Private Sub cmdSave_Click()
'when the user clicks the save button, call
'File|Save. (To jump to this procedure, select 'mnufilesave_cl ick' and
press Shift+F2.)
mnuFileSave_Cli ck
End Sub
Private Sub dtaAddress_Repo sition()
Dim X As Integer, NewRec As Integer
If dtaAddress.Edit Mode = 2 Then ' You're editing a new record.
mnuFileSave.Ena bled = True
'disable add, delete menu items
For X = 0 To 1: mnuRecSub(X).En abled = False: Next X
Else
mnuFileSave.Ena bled = False
For X = 0 To 1: mnuRecSub(X).En abled = True: Next X
End If
cmdSave.Enabled = mnuFileSave.Ena bled
If dtaAddress.Reco rdset.BOF Then
Beep
mnuRecSub(4).En abled = False
ElseIf dtaAddress.Reco rdset.EOF Then
Beep
mnuRecSub(5).En abled = False
Else
For X = 3 To 6: mnuRecSub(X).En abled = True: Next X
End If
End Sub
Private Sub Form_Load()
Center Me
lblAddrId.BackC olor = txtAddress(1).B ackColor
End Sub
Private Sub Form_Unload(Can cel As Integer)
End
End Sub
Private Sub mnuFileExit_Cli ck()
End
End Sub
Private Sub mnuFileSave_Cli ck()
dtaAddress.Upda teRecord
End Sub
Private Sub mnuLookSub_Clic k(Index As Integer)
Dim Prompt As String, Title As String, Default As String, l As Integer
Dim Sought As String, Field As String, SQL As String
Dim MyCriteria As String
Select Case Index
Case Is < 5
Prompt = Mid$(mnuLookSub (Index).Caption , 4) 'strip out leading "by "
l = InStr(Prompt, "&")
If l <> 0 Then Prompt = Left$(Prompt, l - 1) & Mid$(Prompt, l + 1)
Title = "Search by " & Prompt
Prompt = "Enter all or part of the " & Prompt & " to search for:"
Default = ""
Sought = InputBox(Prompt , Title, Default)
If Sought = "" Then Exit Sub
Select Case Index
Case 0: Field = "Lastname"
Case 1: Field = "Firstname"
Case 2: Field = "Company"
Case 3: Field = "City"
Case 4: Field = "State"
End Select
SQL = "Select * from Addresses where " & Field & " LIKE '" & Sought
& "*'"
Debug.Print SQL
dtaAddress.Reco rdSource = SQL
dtaAddress.Refr esh'<----------here
Case 5
End Select
End Sub
Private Sub mnuRecSub_Click (Index As Integer)
Select Case Index
Case 0 'add
dtaAddress.Reco rdset.AddNew
txtAddress(1).S etFocus
Case 1 ' delete
If MsgBox("Delete this Record?", vbQuestion + vbYesNo) = vbYes
Then dtaAddress.Reco rdset.Delete
dtaAddress.Reco rdset.MovePrevi ous
Case 3 ' first
dtaAddress.Reco rdset.MoveFirst
Case 4 ' previous
dtaAddress.Reco rdset.MovePrevi ous
If dtaAddress.Reco rdset.BOF Then
Beep
dtaAddress.Reco rdset.MoveFirst
End If
Case 5 ' next
dtaAddress.Reco rdset.MoveNext
If dtaAddress.Reco rdset.EOF Then
Beep
dtaAddress.Reco rdset.MoveLast
End If
Case 6 ' last
dtaAddress.Reco rdset.MoveLast
End Select
End Sub
Private Sub txtAddress_Chan ge(Index As Integer)
mnuFileSave.Ena bled = True
cmdSave.Enabled = True
End Sub
Private Sub txtAddress_GotF ocus(Index As Integer)
Sel txtAddress(Inde x)
End Sub
Private Sub txtAddress_Lost Focus(Index As Integer)
Dim Temp As String
If Index = 10 Or Index = 11 Or Index = 13 Then
If txtAddress(8) = "USA" And txtAddress(Inde x).Text Like
"########## " Then
Temp = "(" & Left$(txtAddres s(Index), 3) & ") "
Temp = Temp & Mid$(txtAddress (Index), 4, 3) & "-"
Temp = Temp & Mid$(txtAddress (Index), 7)
txtAddress(Inde x) = Temp
End If
End If
End Sub
'Then the added module
Option Explicit
Public Sub Center(f As Form)
f.Move (Screen.Width - f.Width) / 2, (Screen.Height - f.Height) / 2
End Sub
Public Sub Sel(c As Control)
If TypeOf c Is TextBox Then
c.SelStart = 0
c.SelLength = Len(c)
End If
End Sub
Sub Stat(Msg As String)
If frmMain.lblStat us <> Msg Then frmMain.lblStat us = Msg
End Sub 0 3076 This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Batista, Facundo |
last post by:
Here I send it.
Suggestions and all kinds of recomendations are more than welcomed.
If it all goes ok, it'll be a PEP when I finish writing/modifying the code.
Thank you.
.. Facundo
|
by: KLomax |
last post by:
I have a VB6 com object that uses ADO 2.1 for data access.
I have referenced this object in a aspx application.
It works fine on my local development machine.
On our staging server, it errors when trying to
instantiate the com object.
This object runs fine in another asp application on the
same box, so it is not the object itself.
I am remotely compiling the application on our staging
server.
The full error message is below.
|
by: elcc1958 |
last post by:
I need to support a VB6 application that will be receiving
disconnected ADODB.Recordset from out DotNet solution. Our dotnet
solution deals with System.Data.DataTable. I need to populate a
disconnected ADODB.Recordset from System.Data.DataTable data. Below
is the source code I am implementing to test the process. I do not
get any error, that I can see. The problem I have is that at the end,
the recordset seems to be empty. Any...
|
by: Channing Jones |
last post by:
Hello everyone,
I am trying to store data in a binary field of an SQL-Server table using
ADODB.
So far, I have managed to store a record but not any data in the binary
field.
I only get exceptions on various part. I have tried both AppendChunk and
using a stream object.
Unfortunately all the examples I can find in the Net and on the Microsoft
site
|
by: Ireneus Broncel |
last post by:
I have a class which reads Groups and Users from ActiveDirectory. The
Problem is, that i have about 10000 rows as product. When I am trying to
read the "memberOf" Objects out of this field i get allways different
count of rows.
If anybody knows something about this kind of problem, I would
appreciate any help.
Thx.
| |
by: |
last post by:
Hello ppl,
I have snippet that works fine udner ADODB with VB6, but something wrong
with it in Vb.NET. Anyone can help?
Recordset1 (ADODB.Recordset) Error: Arguments are of the wrong type, are out
of acceptable range, or are in conflict with one another.
Error Source:
SELECT * FROM Accounts
|
by: Ames111 |
last post by:
Hi
I have an application that connects to a SQl database on my computer
via an ADODB connection:
ADODB.Connection Conn = new ADODB.Connection();
Conn.ConnectionString = ("Driver={SQL
Server};Server=4P-12.Leighton.local;Database=HD;Uid=l0073;Pwd=cheese");
|
by: Slim |
last post by:
What are the pros and cons of using ADODB in ASP.NET v System.Data
namespace?
I not refereeing to supplying data to controls but for manipulating with
code.
I prefer to use ADODB, but is there any performance benifits from using
System.Data namespace?
thanks
|
by: EYE4U |
last post by:
Hi all,
This is how you can connect to an Access Database using ADODB..
First add a reference to Microsoft ActiveX Data Objects 2.0 Library
Now to lets Declare some variables :
Private Con As New ADODB.Connection
Private Rec As New ADODB.Recordset
* You can set them to Public too if you want to access the Connection and Recordset in any other Form or Module.
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |