Visual Basic Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreVisual Basic Programming

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 Dev Shed Forums Sponsor:
1200+ fellow developers rate and compare features of the top IDEs, like Visual Studio, Eclipse, RAD, Delphi and others, across 13 categories. Enjoy this FREE Download of the IDE User Satisfaction Study by Evans Data Corporation. Download Now!
  #1  
Old October 23rd, 2003, 06:29 PM
ProggerPete ProggerPete is offline
Contributing User
Dev Shed Beginner (1000 - 1499 posts)
 
Join Date: May 2003
Location: Brisbane, Australia
Posts: 1,431 ProggerPete User rank is Sergeant (500 - 2000 Reputation Level)ProggerPete User rank is Sergeant (500 - 2000 Reputation Level)ProggerPete User rank is Sergeant (500 - 2000 Reputation Level)ProggerPete User rank is Sergeant (500 - 2000 Reputation Level)ProggerPete User rank is Sergeant (500 - 2000 Reputation Level) 
Time spent in forums: 1 Week 1 Day 22 m 9 sec
Reputation Power: 23
Using an Access form to maintain an Access database

Hi, I'm just getting started with Access and am having problems with what is basically a trivial task.

I've got a table with only one column (called group). This column is the primary key and hence can contain no duplicates. I've created a from which references that database that I want to use to add, delete and edit entries in the table..

The form consists of
* 4 buttons - Add, Save, Delete & Close
* 1 listbox - this is bound the the group column
* 1 textbox - also bound to the group column

I have the add button working fine, but have problems when trying to edit and delete.

When I select a group in the list box it displays in the textbox. If I edit it and hit my save button it saves over the 1st record in my list.

If I try and delete a record other than the 1st record in my list it tells me the operation will create duplicates and will be canceled.

I believe the problem is that regardless of which item i've selected in the list box and what is displayed in the textbox, the form is always looking at the 1st record.

Has anyone got ideas as to how i fix this??

Thanx,
Pete

Reply With Quote
  #2  
Old October 25th, 2003, 11:12 PM
cleverpig cleverpig is offline
Contributing User
Dev Shed Beginner (1000 - 1499 posts)
 
Join Date: Jul 2003
Posts: 1,152 cleverpig User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 7
Send a message via MSN to cleverpig
Plz post your all code or problem part of the code to us..It's a fast way to find the resolve this problem..

Reply With Quote
  #3  
Old October 26th, 2003, 05:01 PM
ProggerPete ProggerPete is offline
Contributing User
Dev Shed Beginner (1000 - 1499 posts)
 
Join Date: May 2003
Location: Brisbane, Australia
Posts: 1,431 ProggerPete User rank is Sergeant (500 - 2000 Reputation Level)ProggerPete User rank is Sergeant (500 - 2000 Reputation Level)ProggerPete User rank is Sergeant (500 - 2000 Reputation Level)ProggerPete User rank is Sergeant (500 - 2000 Reputation Level)ProggerPete User rank is Sergeant (500 - 2000 Reputation Level) 
Time spent in forums: 1 Week 1 Day 22 m 9 sec
Reputation Power: 23
Here's all the code for the form
Code:
Option Compare Database

Private Sub cmdClose_Click()
On Error GoTo Err_cmdClose_Click

    DoCmd.Close

Exit_cmdClose_Click:
    Exit Sub

Err_cmdClose_Click:
    MsgBox Err.Description
    Resume Exit_cmdClose_Click
    
End Sub

Private Sub cmdSave_Click()
On Error GoTo Err_cmdSave_Click

    DoCmd.Requery
    lstGroups.Requery
    
Exit_cmdSave_Click:
    Exit Sub

Err_cmdSave_Click:
    MsgBox Err.Description
    Resume Exit_cmdSave_Click

End Sub

Private Sub cmdNew_Click()
On Error GoTo Err_cmdNew_Click
    
    DoCmd.GoToRecord , , acNewRec
    lstGroups.Requery

Exit_cmdNew_Click:
    Exit Sub

Err_cmdNew_Click:
    MsgBox Err.Description
    Resume Exit_cmdNew_Click
    
End Sub

Private Sub cmdDelete_Click()
On Error GoTo Err_cmdDelete_Click
        
    If MsgBox("WARNING!" & vbCrLf & "This will completely remove this group!" & vbCrLf & vbCrLf & "Are you sure?", vbApplicationModal + vbExclamation + vbDefaultButton2 + vbOKCancel, "Confirmation") = vbOK Then
        DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70
        DoCmd.DoMenuItem acFormBar, acEditMenu, 6, , acMenuVer70
    End If
    
    lstGroups.Requery
    
    

Exit_cmdDelete_Click:
    Exit Sub

Err_cmdDelete_Click:
    MsgBox Err.Description
    Resume Exit_cmdDelete_Click
    
End Sub

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreVisual Basic Programming > Using an Access form to maintain an Access database


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 2 hosted by Hostway