NotInList response

kermit5

Registered User.
Local time
Today, 01:20
Joined
Nov 2, 2001
Messages
122
I have the following code that I am using to enable the user to add a new record to the tblProjectFile by specifying ProjectName. Here is my code:

Dim strMessage As String
Dim strTitle As String
Dim dbsTakeoff As Database
Dim rstProjectName As DAO.Recordset

strMessage = "Are you sure you want to add " & NewData & _
" to the list of projects?"
strTitle = "Takeoff Verification"

If Confirm(strMessage, strTitle) Then
'Open the Takeoff ProjectFile Table and add the NewData value
Set dbsTakeoff = CurrentDb
Set rstProjectName = dbsTakeoff.OpenRecordset("tblProjectFile")
rstProjectName.AddNew
rstProjectName.ProjectName = NewData
rstProjectName.Update
Response = acDataErrAdded 'Requery the list
Else
Response = acDataErrDisplay 'Display the error
End If

I get the following error:
Method or Data member not found on the ProjectName portion of
rstProjectName.ProjectName = NewData line.

ProjectName is the field name in my tblProjectFile. My database name is Dynamic Form Creation.

What am I missing?

Scott
 
Change the line

rstProjectName.ProjectName = NewData

to

rstProjectName!ProjectName = NewData

or

rstProjectName.Fields("ProjectName") = NewData
 

Users who are viewing this thread

Back
Top Bottom