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

entering data in a table

Status
Not open for further replies.

arunsule

Programmer
Mar 31, 2002
6
IN
can data be entered in a table through a code, without useing a form ?
regards
 
Yes, you can enter data by using VBA code to create. The specifics are a little tricky and it all depends upon what you want to do. but, the following is an example of being able to update a field on just certain records in a table.

dim db as DAO.Database
dim rs as DAO.Recordset
Set db = currentdb
set rs = db.Openrecordset("tblCustomers", dbOpendynaset)
rs.movefirst
Do
If rs("CustCity") = "Detroit" then
rs.edit
rs("State") = "Michigan"
rs.update
end if
rs.movenext
loop until rs.eof
rs.close
db.close

This code above will search through the table tblCustomers and find all records where the Customer City is Detroit and update the State field to Michigan.

If you can give me more specifics about what you want to do I can probably help you with that specific issue.

Bob Scriver
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top