Entering a record fields through independent

Posted on Wednesday, February 20, 2008 - 13:22 | by admin |

There are several ways to enter a record, and the most common is to get through a form bound to a table. Another way to do this is through unrelated fields, ie using a form with fields independent unrelated to the table. To
enter the data we use the 'recordset', ie by a code, which in the case of this example is as follows:

Dim db As Database
Dim rs As Recordset

If MsgBox ("Would you like to write?" VbYesNoCancel, "Options") = vbYes Then
"By pressing is asked whether to save the record or not, if so the code continues until end
Set db = CurrentDb ()
Set rs = db.OpenRecordset ("Data", dbOpenTable)
'Open the table to insert the data register

rs.AddNew
rs ("name") = Me! INome
rs ("address") = Me! Imorada
rs ("age") = Me! Iidade
rs.Update 'sends the data to the table
rs.Close 'Clear the data and closes the recordset
Set rs = Nothing
Set db = Nothing

Me.INome = Null 'clears the fields in the form
Me.Imorada = Null
Me.Iidade = Null
MsgBox "Record saved", vbInformation, "Done" 'Display confirmation message
Me.INome.SetFocus' Move the cursor to the first field
Else: Exit Sub
End If

Download: Place Independent

RSS feed | Trackback URI

Reviews »

No comments.

Name (required)
Email (required - not published)
Website
Your comment ( Decrease | Increase )
You can use <a href="" title=""> <abbr title=""> <acronym title=""> <blockquote cite=""> <b> <cite> <code> <del datetime=""> <em> <i> <Q cite=""> <strike> <strong> in the comments.

Presentation

Avatar

Thank you for visiting.
Subscribe to feed not to miss any messages.

Here in blog I will provide examples of working with Microsoft Access and also ask questions to those who ask. More

Want to subscribe?

Subscribe or subscribe by email:
Enter your email:


Ads