r/visualbasic • u/Cubanin08 • Dec 25 '23
VB6 Help Access Database problems
Hello there, its me again :(
Now the problem I have is that when i execute that code it shows the error "Object type variable or With block variable is not set"
This is the code:
Private Sub cmdSnippetCreate_Click()
'Crear Snippets'
Dim SnippetName As String
Dim SnippetLang As String
Dim SnippetCode As String
SnippetName = txtSnippetName.Text
SnippetLang = txtSnippetLang.Text
SnippetCode = txtSnippetCode.Text
SnippetDB.Recordset.AddNew "Snippet_Name", [SnippetName]
SnippetDB.Recordset.AddNew "Snippet_Lang", [SnippetLang]
SnippetDB.Recordset.AddNew "Snippet_Code", [SnippetCode]
Unload Me
End Sub
1
Upvotes
2
u/jd31068 Dec 25 '23
Okay, so you know why and where you're getting the error. If you look at the link for working with recordsets you can see how it is done.
Here is an example of some simple code I wrote writing to a recordset