|
-
May 15th, 2007, 04:46 PM
#1
Thread Starter
Fanatic Member
End Select without Select Case, but Select Case exists...
Code:
Private Sub RecordControls_Click
Select Case Index
Case 0
On Error GoTo ErrorHandler
If MasterControl.Text = "" Then
MsgBox "You must specify a header in which to put the data.", vbInformation, App.Title
Exit Sub
End If
For i = 0 To Data.Count - 1
If Data(i).Text = "" Or DataType.Text = "" Then
MsgBox "One or more of the required fields have not been filled in.", vbInformation, "Cannot continue"
Exit Sub
End If
Next i
RecordSource = "SELECT * FROM " & MasterControl.Text & " ORDER BY Name"
ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\Databases\" & MasterControl.Text & ".mdb;Persist Security Info=False"
rs.Open RecordSource, ConnectionString, adOpenKeyset, adLockOptimistic
For i = 1 To rs.RecordCount
If rs.BOF = False Then
rs.MoveFirst
End If
If rs.EOF = True Then Exit For
If Data(0).Text = rs!Name Then
MsgBox "Duplicate items not allowed", vbCritical, "Can't create record"
Exit Sub
Else
rs.MoveNext
End If
rs.AddNew
rs!Name = Data(0).Text
rs!DataType = DataType.Text
rs!Data = Data(1).Text
rs.Update
rs.Close
Set WkSpc = Nothing
Set rs = Nothing
OrganizerDatabase.ListItems.Add , , Data(0).Text
End Select
End Sub
As you can see, Select Case is the very first line in my code, yet it gives me the aforementioned error. Why is this?
Also, I need to know how to catch cancel button clicks when creating a new datalink dynamically.
This code opens a box that creates a new dynamic datalink to the database you choose. It's just like right-clicking a udl file and selecting properties.
Code:
Set conn = dl.PromptNew
I want to know how to catch cancel button clicks from this box.
Last edited by hothead; May 15th, 2007 at 04:54 PM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|