Data Write

MikeEller

Registered User.
Local time
Today, 15:55
Joined
Jan 7, 2005
Messages
32
When does form data get written to a table?

I want to use the value from a textbox as openargs for another form. If I don't do a write to the table with SQL, then I get a NULL error on the getOpenArgs on the form. If I do do a write, then I get multiple occurrances of the record.

Thanks,
Mike
 
Just after the BeforeUpdate event of the form if that helps you.
 
When I do the write, as follows:

DoCmd.GoToRecord acDataForm, "frmMain", acNewRec
sqlText = "INSERT INTO tblmain (controlnum) VALUES ('" & tskNum & "');"
DoCmd.RunSQL sqlText

This works fine

but then I do this:

strRecord = "SELECT * FROM tblmain WHERE controlnum = '" & tskNum & "'"
Me.RecordSource = strRecord

And I get an error message: Run Time Error 2001
You canceled the previous operation.

If I don't do this, then when I open the second form make some data selections and write that data to the corresponding record (identified by the form's openargs) the I have three new records added to the table.
I cannot figure out how it is doing this.

Mike
 
Don't change the RecordSource! Just do a Me.Requery.
 

Users who are viewing this thread

Back
Top Bottom