S
scott
hi
I'm having a little trouble putting something together in MS Access
I trying to create a problem recording db. there is a 'problem' table that
should hold the problem number, date opened, owner etc. etc., that part
work, no problems there. the table has the following fields
pr_index (autonumber - primary key)
pr_number (unique internally assign number for this problem)
pr_owner (who the problem is assigned to)
pr_date (date pr opened)
what I'm now trying to add in, is a second table to contain notes entered
about each problem. I have created a 'notes' table with the fields
note_id (autonumber - primary key)
pr_number (foreign key that links up a with pr_number in the main problems
table)
notes_text (255 char text area)
notes_date (stores the date and time of the note entry)
I created a form, and can sucessfully populate the main table with a
pr_number, owner, and date. what I'm now trying to do is add a text entry
box onto the form, that is bound to the notes table, not the 'problem' table
what I'm trying to get to happen, is that when the record is submitted, it
takes the pr_number from the form (which is actually bound to the
'problems.pr_number' table/field), along with the text in the unbound
'note_text' field (don't seem to be able to bind to multiple table on a form
?) and populate the 'notes' table
I created a button with the following event code
Private Sub add_button_Click()
On Error GoTo Err_add_button_Click
DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
DoCmd.OpenQuery "insert_initial_notes"
DoCmd.GoToRecord , , acNewRec
Exit_add_button_Click:
Exit Sub
and then created an 'insert_initial_notes' append query with the following
INSERT INTO notes (pr_number, notes_text)
VALUES (Forms!add_new_problem!pr_number, Forms!add_new_problem!notes_text);
it seems work ok if I run the query in isolation (it prompts for a pr_number
and notes_text), but not when I run it from the form
is there a better way I should be doing this ?
thanks
_scott
I'm having a little trouble putting something together in MS Access
I trying to create a problem recording db. there is a 'problem' table that
should hold the problem number, date opened, owner etc. etc., that part
work, no problems there. the table has the following fields
pr_index (autonumber - primary key)
pr_number (unique internally assign number for this problem)
pr_owner (who the problem is assigned to)
pr_date (date pr opened)
what I'm now trying to add in, is a second table to contain notes entered
about each problem. I have created a 'notes' table with the fields
note_id (autonumber - primary key)
pr_number (foreign key that links up a with pr_number in the main problems
table)
notes_text (255 char text area)
notes_date (stores the date and time of the note entry)
I created a form, and can sucessfully populate the main table with a
pr_number, owner, and date. what I'm now trying to do is add a text entry
box onto the form, that is bound to the notes table, not the 'problem' table
what I'm trying to get to happen, is that when the record is submitted, it
takes the pr_number from the form (which is actually bound to the
'problems.pr_number' table/field), along with the text in the unbound
'note_text' field (don't seem to be able to bind to multiple table on a form
?) and populate the 'notes' table
I created a button with the following event code
Private Sub add_button_Click()
On Error GoTo Err_add_button_Click
DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
DoCmd.OpenQuery "insert_initial_notes"
DoCmd.GoToRecord , , acNewRec
Exit_add_button_Click:
Exit Sub
and then created an 'insert_initial_notes' append query with the following
INSERT INTO notes (pr_number, notes_text)
VALUES (Forms!add_new_problem!pr_number, Forms!add_new_problem!notes_text);
it seems work ok if I run the query in isolation (it prompts for a pr_number
and notes_text), but not when I run it from the form
is there a better way I should be doing this ?
thanks
_scott