Problems adding a field in a record

Essendon

Registered User.
Local time
Today, 16:07
Joined
Oct 25, 2001
Messages
65
With regards to the following simplified code:

*- Start Code

With rst
.AddNew
!strName = "Joe Bloggs" ?
.Update
.Bookmark = .LastModified
End With

*- End Code

I am simply trying to add a record to a table. The line with the question mark throws the following error: "Item not found in colletion".

strName happens to be a string that holds the name of the field that I am wanting to assign the value "Joe Bloggs" to (the way I have it set up, the field name has to come from a string). I know my syntax is incorrect because it would be looking for strName in the collection and not its string value. How do I get it to take the strings value as the field name? (eg if strName = "PersonName" then !PersonName = "Joe Bloggs").

Many Thanks.

Peter
 
Change:
!strName = "Joe Bloggs" ?

to

.Fields(strName) = "Joe Bloggs"
 

Users who are viewing this thread

Back
Top Bottom