|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
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
|
|||
|
|||
|
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 |
|
#2
|
|||
|
|||
|
Plz post your all code or problem part of the code to us..It's a fast way to find the resolve this problem..
|
|
#3
|
|||
|
|||
|
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
|
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > Visual Basic Programming > Using an Access form to maintain an Access database |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|