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

Save/add a record to table from a form

Status
Not open for further replies.

selavarti

Programmer
Feb 24, 2004
33
US
I have created a form to check out a tool by an employee. The control source of the form is from a query that has all the feilds same as in the form. But the fields in the query are from two different tables. When I am adding a record, its overwriting on the first record of the query and not saving as a new record in the table. How to do this. I used command wizard to add new record.
 
Hi

If you used the Add Record wizard to create the button to add the record, it should work

Look at the code in the onclick event of the Add New Record Button and see if it includes a line DoCmd.GoToRecord ,,NewRecord
or something like that

if you are unsure post the code here

Regards

Ken Reay
Freelance Solutions Developer
Boldon Information Systems Ltd
Website needs upgrading, but for now - UK
 
Hi,

Thank you for the reply. I checked the code, but is not adding new record.it is overwriting the first record in the query and putting same thing in the table
Private Sub Command16_Click()
On Error GoTo Err_Command16_Click

DoCmd.GoToRecord , , acNewRec

Exit_Command16_Click:
Exit Sub

Err_Command16_Click:
MsgBox Err.Description
Resume Exit_Command16_Click

End Sub
 
Hi

So you are saying:

You have (say) one record in the table or query

you click the command button Command16

the screen is cleared and an empty record displayed

you fill in the dtails and save it (either by an explicit save button, or by juet moving to another record

you still have only (say) one record in the table or query ?

What setting to you have for the dataentry property of the form?

do you get any error messages?

Regards

Ken Reay
Freelance Solutions Developer
Boldon Information Systems Ltd
Website needs upgrading, but for now - UK
 
Hi,
I am still not able to figure it out. I am not getting any error message. I enter data in the feilds of the form and click add new record, it adds to the table/query..but not as a new record..instead it overwrites the first record in the table/query. I need to figure out that when u add a new record the control should go to last blank record with * and save there as a new record. In my form for data entry I said dataentry no. Other thing is when i set a record source for a form, and when i open the form the fields populate with the already existing value of table/query. I don't want them to do that. I want them to be blank even when they have the control source.

Can u please help me in this.

Thanks
Sudha
 
i did that..but I have a check in feild which should have current system date, but since as its control source is to the check_in in table its not showing system date..its showing null. How to solve this..

thanks
 
Hi

HAve you set the default value of the check_in date (in the table) to Date(), if not do so

Regards

Ken Reay
Freelance Solutions Developer
Boldon Information Systems Ltd
Website needs upgrading, but for now - UK
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top