SOLVED!!!!!! was missing "SELECT" from the code.. OOPS!
Hey all. I have a button coded in VBA to submit the data to a table in my database. When I press the button i get this:
Code:
Run-time error '3078':
The Microsoft Access database engine cannot find the input table or query 'Oname, Oaddress, OCity, OState, OZip, OPhone FROM tblOffice'.
Make sure it exists and that its name is spelled correctly
The code is this:
Code:
Private Sub Command13_Click()
Dim rs As DAO.Recordset
Dim db As Database
Set db = CurrentDb
Set rs = db.OpenRecordset("Oname, oaddress, ocity, ostate, ozip, ophone FROM tblOffice")
With rs
.AddNew
!OName = Me.OName
!OAddress = Me.OAddress
!OCity = Me.OCity
!OState = Me.OState
!OZip = Me.OZip
!OPhone = Me.OPhone
.Update
End With
rs.Close
DoCmd.Close , , acSaveNo
End Sub
And the table is this:
Name - tblOffice
OfficeID - AutoNumber
OName - Short Text
OAddress - Short Text
OCity - Short Text
OState - Number (Looks up value from State Table)
OZip - Short Text
OPhone - Short Text
Thanks in advance for your help.
Z