Append Query needs to add data from a field to the table

GrandMasterTuck

In need of medication
Local time
Today, 15:03
Joined
May 4, 2013
Messages
129
I want to set a table field's default value to whatever is displayed in a certain field on a certain form at the time. Can I do that?

In other words, say I have a database with a table called TABLE1, and two fields called NAME and SCHEDULENUMBER. I have a form called CreateSchedule with a SCHEDULENUMBERCONTROL form and a NAME form, and I can enter names onto it, and it records to the proper SCHEDULENUMBER. So if I pull up SCHEDULENUMBER 4, and add three names, when I go back into TABLE1, I can see those three new names, and each one has the SCHEDULENUMBER set to 4.

What I'm trying to do is write an APPEND QUERY to copy a list of names from a different table, and paste them into TABLE1. The problem is that the other table doesn't have a SCHEDULENUMBER field. What I want to do is put a button on the CreateSchedule form that runs an APPEND QUERY, and sets the SCHEDULENUMBER to whatever value is displayed on CreateSchedule's SCHEDULENUMBERCONTROL field.

I tried setting a default value in TABLE1's field properties for that SCHEDULENUMBERCONTROL field, but I keep getting error messages. I just want TABLE1, whenever I add a new record (regardless of how I add the record: manually typing it or clicking the append query button) to look at the form CreateSchedule, and set it's own SCHEDULENUMBER field to whatever is displayed in CreateSchedule's SCHEDULENUMBERCONTROL form.

Now that I've read over what I typed... it sounds confusing to me. I hope you can decipher it... Anyone have any ideas?
 
Last edited:
You are correct - it is confusing.

Why not just bind the form to your table. Whatever ScheduleNumber is entered in a new record, will be added to the table.

Incidentally, NAME is a reserved word in Access. Use JobName or PersonName or whatever for your field in the table.
 

Users who are viewing this thread

Back
Top Bottom