Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Ok... the product of all the recent question asking =D

Status
Not open for further replies.

Woodman650

Technical User
Jan 20, 2005
92
US
Hey all,
Thanks so much for helping out with all my questions in the past few days (I feel like I've been asking a lot). So, I'm pretty much done with this database project, but I've got a few minor snags... 3 actually.

1) get error when use delete button and select any option other than "yes"
2) my listbox selection does not load the record in the main subform area as it is supposed to (but I think I just don't know how to set this one up)
3) the frmAdd does not allow user to enter values into the fields for some reason, don't know what's up with that one

If anyone could take a peak, check it out, let me know if there is anything I need to fix, or more importantly, how to get those above things sorted out. It would be greatly appreciated. thanks in advance =D


Woody
 
1) yup...
Private Sub AddRecord_Click()
DoCmd.Save
DoCmd.GoToRecord , , acNewRec
End Sub
_____________________________
Private Sub Closefrm_Click()
DoCmd.Close

End Sub
___________________________
Private Sub Form_Close()
If Not Me.Recordset.EOF Then Me.Recordset.Delete
End Sub

2) excellent, that works... but as before, when I add a couple records one after another, the first isn't written to the table
 
btw... what is the tag for inserting code into the post field here in the forum? =D
 
what is the tag for inserting code into the post
To get this:
Code:
My code here
Type this:
[ignore]
Code:
My code here
[/ignore]
 
ahhh, I was using the wrong bracket-type. thanks PHV =D
Code:
neat
 
Leave it to PHV to answer the easy question and leave the hard one for me ... ;)

I posted a bad answer. I'm looking at how to fix it now.

TMTOWDI - it's not just for Perl any more
 
it's quite all right adalger, any answer is better than no answer. I don't know what I'd do without your efforts on this one =D
 
This is tested, and should work:
Code:
Option Compare Database
Option Explicit
[COLOR=black yellow]Private Saved As Boolean[/color]

Private Sub cmdSave_Click()
    DoCmd.GoToRecord , , acNewRec
    Saved = True
End Sub

Private Sub Form_Close()
    If Not Saved Then Me.Recordset.Delete
End Sub

Private Sub Form_Dirty(Cancel As Integer)
    Saved = False
End Sub

Private Sub form_load()
    Saved = True
End Sub

Note the form-level variable declaration.

TMTOWDI - it's not just for Perl any more
 
You guys have done a lot more than I could on this one today. Thanks for stepping in. (And thanks for how to separate the code box in the post, too.)
 
ok, I copied and pasted all of that into my VB window... but I left the
Code:
Private Sub Closefrm_Click()
    Forms("Name_of_form").lstList.Requery
    DoCmd.Close
End Sub
in there.

however, the add button does nothing now. I click it, the form does not change. So I close the form, with the requery on and nothing has been written to the table either (either). hmmm, what do ya think?
 
what is the "private saved as boolen" highlighted for, btw?
 
It's highlighted to draw your attention to it. :)

And the reason your add button is broken is because I named mine cmdSave, and you named yours AddRecord. Just edit the code you pasted to change "cmdSave" to "AddRecord".

TMTOWDI - it's not just for Perl any more
 
durrr... haha, I knew that. ;)
ok, ONE final problem. the entry appears in the listbox when I close the Add form, BUT when I select the new entry in the listbox, the details do not appear in my subform... like the others do. The subform just remains empty.

If you need the most recent file posted to see what I'm talking about, i can get it online in a couple of hours (no ftp access right now).
 
Do the details come from the same table where you just added the record using the form we just fixed?

TMTOWDI - it's not just for Perl any more
 
yes, it all comes from the tblMovies. The subform reads from the listbos via these parameters:

frmSummary > Data
------------------
Source Object: frmSummary
Link Child Fields: [Title]
Link Master Fields: lstList
------------------

I don't get why it doesn't want to display the new entries.
 
I can't open zips at work, but if you want to put it on that site I'll try to find time when I get home tonight to pick at what you've got.

TMTOWDI - it's not just for Perl any more
 
ohhh, ok. I think there is a problem with the way I set the above up, because my edit form messes everything up and does the same thing... won't allow a selection in the listbox to be displayed in the sub form. here is an updated db file from which I'm working:

 
Ah-HAH! Your record source isn't a table, it's a join. And your join is on the CastID field. And your add form doesn't provide a box to enter a cast id, which means it's null in the new record. Therefore the query doesn't pick it up.

If it were my project, I'd ... well, I'd probably rework the table structure a lot, immediately.

TMTOWDI - it's not just for Perl any more
 
haha. uhoh. It's my first database! I thought I was on a roll! How would you fix it?! I'm desperate!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top