View Full Version : Need a bit o' help - nothing big! [newb]
kingzl3y 03-20-2008, 02:33 PM Hoihoi,
Well, Hello..
Never thought I'd register on an Access forum, but, hey, why not!
I'm new to Access, never really liked it..but this assignment has changed me.. i really like Access and well DBA'ing in general!
I need a bit of help with a few things:
-----I hate registering on sites JUST asking for answers >< I hope to learn a lot of stuff from here!
-------Just like to add it's for an Assignment at college, i KNOW I KNOW you people can't help with assignment work, BUT it's not like i'm asking you to do it for me, just need a bit of help
Basically,
I've got a database -
It's based on a Mobile Library which visits nurseries.
The nursery can loan a book, if a book is currently being loaned by a nursery and another nursery wants to loan that book, they can reserve it untill it is returned.
Basically, I've got a few forms:
21233
I can do everything fine!
Everything seems to work, i can loan and reserve..
i can add books, nurseries and authors
..
HOWEVER
when it comes to deleting.. it's a different story!
On my delete_author form, I've got a Combobox which loads the authors and then i've got a Delete button which should delete the author which is in the combobox
---- I've google'd for ages..and can't make much sense of any of the replies people have had..
Is there anyone who can help me with this?
Delete the author which is in the combo box..
I can supply any details if people are willing to help :o
Would LOVE to hear a reply from anyone!
Cheers :)
boblarson 03-20-2008, 02:41 PM For simplicity's sake - The delete button should use a delete query to delete the author from the table. Then you use
Me.YourComboName.Requery
to reflect the changes in the combo.
Now it can get more complex if you just want to remove them from the combo and not from the table. For that you would need to have some method of keeping an exclusion list - maybe a temp table for that then and base the combo's rowsource on that and then requery as necessary.
Hope that helps.
RuralGuy 03-20-2008, 02:44 PM What method are you using to actually delete the author? Macro, code, something else??? How about posting the macro/code/whatever so we can see it and maybe offer a suggestion. Is it giving you an error? If so, what error?
pbaldy 03-20-2008, 02:52 PM Welcome to the site and the insanity that is Access. :D
I would add that you'll need to watch out for referential integrity. If you have it established between say books and authors, and you have a book listing Joe Blow as an author, you will not (and should not) be able to delete Joe Blow from authors.
kingzl3y 03-20-2008, 04:53 PM Jebus!
Those were fast replies!
No boblarson, when i select the author from the combobox and press delete i actually want it to delete the author from the table.
I haven't really thought of that - haven't really used queries that much to know that either! I'll give it a bash!
RuralGuy,
I'm pretty sure i'm not using any code..
I didn't think i had to..but then when i thought about it knew i had to :' )
Which is why i asked for help on here..
Before,
I just had a combobox with got the authors from the authors table..and then i had a delete button which deleted that record..
BUT
i noticed it didn't delete the author i selected in the combo box..
Lets say i had 3 authors
1) Joe Bloggs
2) Paul Smith
3) Henry Lloyd
and i selected ID:3 Henry Lloyd - instead of deleting #3..it'd actually delete #1 Joe Bloggs..
pbaldy
Cheers dude!
Here's a pic of my relationships, and yes i have referential integrity selected
21234
21235
Well, i'm not too sure what you mean, but with the method i was using before ( ^ ) it was deleting fine, but it was just deleting the wrong one :' )
Cheers for the help dudes!
RuralGuy 03-20-2008, 05:13 PM Is the ComboBox moving the form to the record you want to delete? Did you use a wizard to create the Delete button? What version of Access are you using? If you look at the event tab of the properties sheet for the Delete Button you should see either [Event Procedure] or some macro name. We would need to see that code/macro.
kingzl3y 03-21-2008, 01:55 AM Yeah, i created the combo box via the wizard.
I'm using Office xp/2002.
Well, that's what i would like to happen - the combobox selects the record, but it doesn't.
Here's the code..
Private Sub Command24_Click()
On Error GoTo Err_Command24_Click
DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70
DoCmd.DoMenuItem acFormBar, acEditMenu, 6, , acMenuVer70
Exit_Command24_Click:
Exit Sub
Err_Command24_Click:
MsgBox Err.Description
Resume Exit_Command24_Click
End Sub
Hope that helps :)
kingzl3y 03-21-2008, 02:38 AM I'll attach my database.
Hope that makes it easier!
-Couldn't upload as a .RAR so i renamed the .RAR to .ZIP
Still opens, but if problems just renamed to 'whatever'.rar
:)
RuralGuy 03-21-2008, 03:06 AM Use the wizard to create a new ComboBox on your Delete form and this time select the 3rd option "find a record...". When the combo box is complete, using it should move the form to that Author. It would be helpful if you put at least the Author's name in a textbox control on the form so you could see what record the form is on.
kingzl3y 03-21-2008, 11:12 AM AH, that's it dude!
Knocked it on the spot!
I've got another problem, well not problem..i want to make it more user-friendly.
Basically, when the user adds a book, they can add it easily..
the only problem is, when ..just say i want to add a book, and I have 10 copies of this book, I have to add the book first and the go into the ADD_BOOK_COPY form and then select the book which i want to add more copies of and click add - i repeat this for the total amount of copies that i have.
So if i had 10 copies of 1 book, i add, and then go into a seperate form and then click this button 9 more extra times.
Which, can cause headahces!
So basically, i'm thinking of implementing a new way to do this,
i was thinking about..
When i got to add a book, there's a List/Combo box with 1-20 into
So i can add the book, and then select how many copies, click 'add' and this will add 20 copies of that bookm firstly by adding it to the 'book' table and then adding 20 copies to the book_copy table..
Is there anyone who would like to help with this? :' )
Cheers btw!
RuralGuy 03-21-2008, 11:26 AM You may want to start a new thread with that last post. This is a different issue and new threads attract new blood. ;)
kingzl3y 03-21-2008, 11:47 AM Thanks dude!
Your above method worked perfectly!
Can Delete Books and Authors from tables :)
RuralGuy 03-21-2008, 11:55 AM Glad I could help.
GaryPanic 03-22-2008, 12:39 AM for once -- a student who is actually asking for help in a logical manner ..
:)
kingzl3y 03-22-2008, 02:32 PM xD
I know, I never see any other students asking nicely.
They just demand you help them :')
Which is probably why half of their answers don't get answered.
RuralGuy 03-22-2008, 03:15 PM You hit the nail right on the head! You were different so I chose to respond.
kingzl3y 03-22-2008, 04:09 PM AH, that's good to know then!
Yeah, I've noticed on most forums, new comers just register, write a question and then expect every member to answer it :' )
I'm different, I know most people won't..
you've got to attract them :' )
OH, maybe you can help me on another question
- It's another newb one :'D
gemma-the-husky 03-22-2008, 04:19 PM the other thing is, its clear you did/tried a lot of stuff yourself, before asking.
We all need help somewhere along the way
kingzl3y 03-22-2008, 04:35 PM You're exactly right.
You can't just ask for help without trying stuff yourself..
where's the fun in that!
PLUS by doing so you might even find it out yourself....
IF
answer_found <> yes
then
ask = yes
end if
</geek>
:' )
|
|