If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > Visual Basic > adding problem

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 05-30-09, 00:42
ankiesiau ankiesiau is offline
Registered User
 
Join Date: May 2009
Posts: 17
adding problem

Code:
Dim conMember As ADODB.Connection
Dim rsMember As ADODB.Recordset

Private Sub cmdAdd_Click()
If cmdAdd.Caption = "&Add" Then
  adoMember.Recordset.AddNew
  txtMemberID.SetFocus
  cmdSave.Enabled = True
  cmdAdd.Caption = "&Cancel"
  DisableButton
Else
  adoMember.Recordset.CancelUpdate
  EnableButton
  cmdSave.Enabled = False
  cmdAdd.Caption = "&Add"
End If
End Sub
When i click add, a msg box occurs. Run time error'91': Object variable or with block variable not set.
How to solve it?
Attached Thumbnails
adding problem-bookpro.jpg  
Reply With Quote
  #2 (permalink)  
Old 05-30-09, 01:10
jp26198926 jp26198926 is offline
Registered User
 
Join Date: May 2009
Location: Philippines
Posts: 12
are u already connected to ur database?
__________________
"More Heads Are Better Than One"
Reply With Quote
  #3 (permalink)  
Old 05-30-09, 01:38
ankiesiau ankiesiau is offline
Registered User
 
Join Date: May 2009
Posts: 17
Quote:
Originally Posted by jp26198926
are u already connected to ur database?
ya

Code:
Private Sub Form_Load()
Set conMember = New ADODB.Connection
Set rsMember = New ADODB.Recordset

conMember.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
    "persist Security Info=false; Data Source =" & App.Path & "\Membership.mdb"
      
conMember.Open
With rsMember
    .CursorLocation = adUseClient
    .CursorType = adOpenDynamic
    .LockType = adLockOptimistic
    .Open "Member", conMember, , , adCmdTable
End With
Call LoadMemberRecord
End Sub
Reply With Quote
  #4 (permalink)  
Old 05-30-09, 03:53
jp26198926 jp26198926 is offline
Registered User
 
Join Date: May 2009
Location: Philippines
Posts: 12
Quote:
Originally Posted by ankiesiau
Code:
Dim conMember As ADODB.Connection
Dim rsMember As ADODB.Recordset

Private Sub cmdAdd_Click()
If cmdAdd.Caption = "&Add" Then
  adoMember.Recordset.AddNew
  txtMemberID.SetFocus
  cmdSave.Enabled = True
  cmdAdd.Caption = "&Cancel"
  DisableButton
Else
  adoMember.Recordset.CancelUpdate
  EnableButton
  cmdSave.Enabled = False
  cmdAdd.Caption = "&Add"
End If
End Sub
When i click add, a msg box occurs. Run time error'91': Object variable or with block variable not set.
How to solve it?

ur adoMember is an Adodc control? if so then.
u must connect ur some controls to ur adodc

txtMemberID.Datasource = adoMember
txtMemberID.Datafield = <name of the fields of ur table>
__________________
"More Heads Are Better Than One"

Last edited by jp26198926; 05-30-09 at 03:57.
Reply With Quote
  #5 (permalink)  
Old 05-31-09, 00:43
ankiesiau ankiesiau is offline
Registered User
 
Join Date: May 2009
Posts: 17
Quote:
Originally Posted by jp26198926
ur adoMember is an Adodc control? if so then.
u must connect ur some controls to ur adodc

txtMemberID.Datasource = adoMember
txtMemberID.Datafield = <name of the fields of ur table>
Thanks you very much.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On