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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Allow Additions 1

Status
Not open for further replies.

Sameal

Programmer
Aug 6, 2001
142
US
I have been fumbling with this one for a little bit. I'm looking for good alternative ways of doing this or a fix to the current route I'm taking. Currently when a worker prints a formal quote, a box pops up asking how many weeks and/or how many days do you want to give the receipiant to respond to quote. This box then takes the current date and uses the DateAdd() to add the given weeks and days and prints this new date onto the hardcopy report that gets faxed.

My problem is this, I wanted a way for this box to "remember" the days and weeks that were last used even if the program is closed and reopened so I had to come up with some kind of file I/O. I then realized that I could use a table for this, but render it impossible to add new entries to it. Basically making it always have one row which contains the last entered data for this form.

So I create my form and my table and link them together. Then I go to set the form properties so that you can not add any new entries, and can not delete any entries. But I wanted to leave it where you could edit the entry that should always be loaded. The problem now is that when I switch between design view and form view, the controls disappear completely and I am left with a blank form. I found that by setting the Allow Additions back to YES makes the form appear but this makes it possible to make multiple entries into the underlying table. Could anyone offer me any ideas? Thanks.

Sameal
 
If you only want this table to have the last information entered then whenever there is antry into the table, delete the entire contents of the table before the entry is made.

In code right after prompt:

DoCmd.RunSQL("DELETE * FROM tblDate;")
DoCmd.RunSQL("INSERT INTO tblDate (DateField) VALUES
(Forms!frmName!TextBox);")

You'll probably have to play with the syntax a little ie: proper names and all. But this should get you started
 
is the form set to datenty = yes
change it to no
 
Also be sure the is one record in the table already
 
Philly44,

Thanks, your idea definately works. =)

Gol4,

Yes the Data Entry propery is set to No.
I went back and put two entries into the table and left it where only the first one would hold any valid data and you were right, the form began to function correctly.

Thankyou both of you.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top