Microsoft Access Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsDatabaseMicrosoft Access Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread ASP Free Forums Sponsor:
  #1  
Old December 4th, 2003, 10:37 AM
spearssc spearssc is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Dec 2003
Posts: 12 spearssc User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 4 m 7 sec
Reputation Power: 0
Delete Command Button

I'm new to Access and VBA and I need assistance.

I'm building a form that has a subform. I have a delete button on the main form that is not allowing deletes from the subform. I used the command button wizard to build the delete button but it doesn't work. I've tried to add vba behind the button and it's not working either. I received an error message on: Dim mydb As Database

Dim response As Integer
Dim mydb As Database „³ it said Database was invalid
Dim system As Recordset

response = MsgBox("Delete current employee?", 289, "Verify Delete")

If response = 1 Then
Set mydb = DBEngine.Workspaces(0).Databases(0)
Set system = mydb.OpenRecordset("Systems", DB_OPEN_TABLE)

system.MoveFirst

foundemp = 0

Do Until (system.EOF Or foundemp = 1)

If (system![System Name] = Forms![SystemsEntry]![System Name]) Then
foundemp = 1
Else
system.MoveNext
End If

Loop

Do Until (system.EOF)

If (system![System Name] = Forms![SystemsEntry]![System Name]) Then

system.Delete

End If

Loop

system.Delete

DoCmd.ShowAllRecords

system.Close
End If

End Sub


I've tried to add the delete button to the subform and it's not showing.

If anyone can help me it is much appreciated.

Reply With Quote
  #2  
Old December 4th, 2003, 11:02 AM
sbaxter sbaxter is offline
Moderator: Access, SQL
ASP Free God (5000 - 5499 posts)
 
Join Date: Oct 2003
Posts: 5,126 sbaxter User rank is Corporal (100 - 500 Reputation Level)sbaxter User rank is Corporal (100 - 500 Reputation Level)sbaxter User rank is Corporal (100 - 500 Reputation Level)sbaxter User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 4 Days 1 h 2 m 51 sec
Reputation Power: 12
Do you a have a DAO library referenced in you DB? ( For example Microsoft DAO 3.6 Library Object)

Also

Dim mydb As Database

Remove the "„³ "

S-

Reply With Quote
  #3  
Old December 4th, 2003, 11:10 AM
spearssc spearssc is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Dec 2003
Posts: 12 spearssc User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 4 m 7 sec
Reputation Power: 0
S,

I don't think I have this anywhere. I have one form where the delete button is deleting from my table but that form doesn't have a subform so I'm thinking I have to specifiy the form somehow but I'm not sure how to do this.

As for the "„³ " that was a comment I had in there to show I got an error on that line.

Reply With Quote
  #4  
Old December 4th, 2003, 02:10 PM
sbaxter sbaxter is offline
Moderator: Access, SQL
ASP Free God (5000 - 5499 posts)
 
Join Date: Oct 2003
Posts: 5,126 sbaxter User rank is Corporal (100 - 500 Reputation Level)sbaxter User rank is Corporal (100 - 500 Reputation Level)sbaxter User rank is Corporal (100 - 500 Reputation Level)sbaxter User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 4 Days 1 h 2 m 51 sec
Reputation Power: 12
Can you post your DB?
S-

Reply With Quote
  #5  
Old December 4th, 2003, 02:57 PM
spearssc spearssc is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Dec 2003
Posts: 12 spearssc User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 4 m 7 sec
Reputation Power: 0
Delete Commad Button

The forms I'm having problems with are the SystemsEntry, TasksEntry and EmployeePayInformationDataEntry

Reply With Quote
  #6  
Old December 4th, 2003, 03:03 PM
spearssc spearssc is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Dec 2003
Posts: 12 spearssc User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 4 m 7 sec
Reputation Power: 0
Delete Command Button

Sorry it's telling me my DB is too big. I even zipped it. Or, I get the "Page cannot be found".

Reply With Quote
  #7  
Old December 4th, 2003, 03:54 PM
sbaxter sbaxter is offline
Moderator: Access, SQL
ASP Free God (5000 - 5499 posts)
 
Join Date: Oct 2003
Posts: 5,126 sbaxter User rank is Corporal (100 - 500 Reputation Level)sbaxter User rank is Corporal (100 - 500 Reputation Level)sbaxter User rank is Corporal (100 - 500 Reputation Level)sbaxter User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 4 Days 1 h 2 m 51 sec
Reputation Power: 12
Turn on

Allow private message and I will sen you info for an ZTP site to upload it to as long as it is less then 5MB

S0

Reply With Quote
  #8  
Old December 4th, 2003, 04:04 PM
spearssc spearssc is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Dec 2003
Posts: 12 spearssc User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 4 m 7 sec
Reputation Power: 0
It's set to allow PM but not to send me email.

Reply With Quote
  #9  
Old December 4th, 2003, 04:57 PM
sbaxter sbaxter is offline
Moderator: Access, SQL
ASP Free God (5000 - 5499 posts)
 
Join Date: Oct 2003
Posts: 5,126 sbaxter User rank is Corporal (100 - 500 Reputation Level)sbaxter User rank is Corporal (100 - 500 Reputation Level)sbaxter User rank is Corporal (100 - 500 Reputation Level)sbaxter User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 4 Days 1 h 2 m 51 sec
Reputation Power: 12
Which form has this code in it? I can't find the code anywhere.
S-

Reply With Quote
  #10  
Old December 4th, 2003, 05:04 PM
sbaxter sbaxter is offline
Moderator: Access, SQL
ASP Free God (5000 - 5499 posts)
 
Join Date: Oct 2003
Posts: 5,126 sbaxter User rank is Corporal (100 - 500 Reputation Level)sbaxter User rank is Corporal (100 - 500 Reputation Level)sbaxter User rank is Corporal (100 - 500 Reputation Level)sbaxter User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 4 Days 1 h 2 m 51 sec
Reputation Power: 12
The reason your VBA code didn't work (to start with) IS you haven't reference the DAO library

Go to you VB editor
Tools References and put checks in the boces of the following libraries

Microsoft DAO 3.6 Library Object

S-
Play with this.

I am also attaching a DB that show code on how to delete a record using DAO, and ADO

S-

Reply With Quote
  #11  
Old December 5th, 2003, 01:04 PM
sbaxter sbaxter is offline
Moderator: Access, SQL
ASP Free God (5000 - 5499 posts)
 
Join Date: Oct 2003
Posts: 5,126 sbaxter User rank is Corporal (100 - 500 Reputation Level)sbaxter User rank is Corporal (100 - 500 Reputation Level)sbaxter User rank is Corporal (100 - 500 Reputation Level)sbaxter User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 4 Days 1 h 2 m 51 sec
Reputation Power: 12
Do you still need help or are you okay?

S-

Reply With Quote
Reply

Viewing: ASP Free ForumsDatabaseMicrosoft Access Help > Delete Command Button


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 4 hosted by Hostway