Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Combobox
Message
 
To
04/05/2004 18:27:48
General information
Forum:
Visual Basic
Category:
Coding, syntax & commands
Title:
Miscellaneous
Thread ID:
00900395
Message ID:
00901187
Views:
31
Hi Budd:
How are ya?
Below is my code per your request.
I call the Sub GetData from Form_Load event. In Getdata I am trying to set to focus to one of my textbox on the form. What should I do?

Thanks
MA

Private oDataConn As ADODB.Connection
Private oRecSet As ADODB.Recordset
Private dbCommand As New ADODB.Command
Private lModified As Boolean
Private Sub getdata()
Dim lMetting As String
Dim nRecCnt%

On Error GoTo ErrorHandler
'Make connection to DB
Set oDataConn = New ADODB.Connection
oDataConn.ConnectionString = "DSN=Datawarehouse"

oDataConn.Open

Set oRecSet = New ADODB.Recordset
Set oRecSet.ActiveConnection = oDataConn
' Create command object
dbCommand.ActiveConnection = "DSN=DatawareHouse;UID=sa;pwd=;"

oRecSet.CursorLocation = adUseClient
oRecSet.CursorType = adOpenDynamic
oRecSet.LockType = adLockOptimistic
oRecSet.CacheSize = 3

oRecSet.Open "SELECT * FROM Meetings Group by Meeting_ID,Meeting_name,Meeting_Location," & _
" Meeting_City_State,Start_Date,End_Date Order by Meeting_Name," & _
"Meeting_Location", oDataConn

If oRecSet.RecordCount > 0 Then
'Form1.SSTab1.Tab = 0
MoveRecord "Move_First", "True"
End If
Call Populate_State 'Get the states
oRecSet.ActiveConnection = Nothing

If Err Then
ErrorHandler:
Dim strErr As String
Select Case Err
Case adErrObjectOpen
strErr = "Error #" & Err.Number & ": " & Err.Description & vbCrLf
strErr = strErr & "Error reported by: " & Err.Source & vbCrLf
strErr = strErr & "Help File: " & Err.HelpFile & vbCrLf
strErr = strErr & "Topic ID: " & Err.HelpContext
MsgBox strErr
Debug.Print strErr
Err.Clear
Resume Next
' If some other error occurs that
' has nothing to do with ADO, show
' the number and description and exit.
Case Else
strErr = "Error #" & Err.Number & ": " & Err.Description & vbCrLf
strErr = strErr & "Error reported by: " & Err.Source & vbCrLf
MsgBox strErr
Debug.Print strErr
Unload Me
End Select
txtMeeting.Setfocus 'Set the focus to Meeting text box
End If
End Sub
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform