Click here to Skip to main content
15,910,471 members
Home / Discussions / Visual Basic
   

Visual Basic

 
GeneralRe: View Network SQL Servers Pin
William Winner8-Feb-10 10:27
William Winner8-Feb-10 10:27 
GeneralRe: View Network SQL Servers Pin
Dave Kreskowiak8-Feb-10 15:54
mveDave Kreskowiak8-Feb-10 15:54 
AnswerRe: View Network SQL Servers Pin
tosch7-Feb-10 20:44
tosch7-Feb-10 20:44 
GeneralRe: View Network SQL Servers Pin
Luc Pattyn8-Feb-10 10:44
sitebuilderLuc Pattyn8-Feb-10 10:44 
QuestionAssistance on Syntax with regards to Runtime Error-91 in VB 6.0 Pin
Ace Anthony C. Austria5-Feb-10 23:39
Ace Anthony C. Austria5-Feb-10 23:39 
AnswerRe: Assistance on Syntax with regards to Runtime Error-91 in VB 6.0 Pin
DaveAuld6-Feb-10 3:04
professionalDaveAuld6-Feb-10 3:04 
AnswerRe: Assistance on Syntax with regards to Runtime Error-91 in VB 6.0 Pin
Eddy Vluggen7-Feb-10 21:35
professionalEddy Vluggen7-Feb-10 21:35 
AnswerRe: Assistance on Syntax with regards to Runtime Error-91 in VB 6.0 Pin
BlackCatDeveloper11-Feb-10 12:43
BlackCatDeveloper11-Feb-10 12:43 
That particular error usually means that one of the object that you are referencing does not have an instance. I suggest placing a break point on the first line that your code has trouble. Then use the immediate pane to check that each of your objects has an instance such as "?AdoAudit is nothing", and then "?AdoAudit.Recordset is nothing", etc. It'll return true/false for each object that you do this with.

Here is a an example that accomplishes what you are looking to do in your cmdSave_Click event. Note: be sure to replace the Const values. Hopefully, this working model (I tested it on my computer) will help you identify where your code went off.

Private Sub cmdSave_Click()

    'enter values for your scenario
    Const connStr As String = "<replace with the connection string to connect to your Access DB>"
    Const tableName As String = "<replace with the table name of the table you wish to save to>"

    'vars
    Dim dbConn As ADODB.Connection
    Dim saveRec As ADODB.Recordset
    
    'initialize & open connection to DB
    Set dbConn = New ADODB.Connection
    dbConn.Open connStr
    
    'initialize & open recordset to table
    Set saveRec = New ADODB.Recordset
    saveRec.Open "SELECT TOP 0 * FROM [" & tableName & "]", dbConn, adOpenDynamic, adLockOptimistic
    
    'create new record
    saveRec.AddNew
    
    'save data to new record
    saveRec("Operation") = "Added or Altered Reference Material"
    saveRec("DateDone") = Format(Now, "mm-dd-yyyy")
    saveRec("TimeDone") = Format(Now, "hh:mm:ss ampm")
    
    'save record
    saveRec.Update
    
    'clean up
    saveRec.Close
    Set saveRec = Nothing
    
    dbConn.Close
    Set dbConn = Nothing

End Sub

QuestionGet File Advanced Setting Pin
Padma N5-Feb-10 23:05
Padma N5-Feb-10 23:05 
AnswerRe: Get File Advanced Setting Pin
DaveAuld6-Feb-10 3:11
professionalDaveAuld6-Feb-10 3:11 
QuestionSomebody help me! Pin
chazy_chaz6405-Feb-10 22:26
chazy_chaz6405-Feb-10 22:26 
AnswerRe: Somebody help me! Pin
Johan Hakkesteegt5-Feb-10 22:48
Johan Hakkesteegt5-Feb-10 22:48 
AnswerRe: Somebody help me! Pin
Richard MacCutchan5-Feb-10 22:48
mveRichard MacCutchan5-Feb-10 22:48 
AnswerRe: Somebody help me! Pin
Dave Kreskowiak6-Feb-10 5:36
mveDave Kreskowiak6-Feb-10 5:36 
AnswerRe: Somebody help me! Pin
loyal ginger6-Feb-10 9:51
loyal ginger6-Feb-10 9:51 
QuestionMDI children w/progress bars not asynchronously updating Pin
Jim Dolson5-Feb-10 14:32
Jim Dolson5-Feb-10 14:32 
AnswerRe: MDI children w/progress bars not asynchronously updating Pin
Luc Pattyn5-Feb-10 15:00
sitebuilderLuc Pattyn5-Feb-10 15:00 
AnswerRe: MDI children w/progress bars not asynchronously updating Pin
Wayne Gaylard5-Feb-10 17:25
professionalWayne Gaylard5-Feb-10 17:25 
QuestionKeypress Event Double Firing Pin
eddieangel5-Feb-10 13:07
eddieangel5-Feb-10 13:07 
AnswerRe: Keypress Event Double Firing Pin
Luc Pattyn5-Feb-10 13:21
sitebuilderLuc Pattyn5-Feb-10 13:21 
Questiongood coding practices? Pin
kmas37525-Feb-10 8:26
kmas37525-Feb-10 8:26 
AnswerRe: good coding practices? [modified] Pin
Ray Cassick5-Feb-10 8:59
Ray Cassick5-Feb-10 8:59 
AnswerRe: good coding practices? Pin
MicroVirus5-Feb-10 11:26
MicroVirus5-Feb-10 11:26 
AnswerRe: good coding practices? Pin
DaveAuld5-Feb-10 20:10
professionalDaveAuld5-Feb-10 20:10 
AnswerRe: good coding practices? Pin
William Winner8-Feb-10 9:44
William Winner8-Feb-10 9:44 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.