I am trying to .addnew to my db. Brief History: I have created code that appends fields to a table (which the user types in what they want). I want to append records to these fields, but since I obviously don't know the names of the fields prior to writing the code I was setting it up as follows:
Set dbAddPhases = CurrentDb
Set rstAddPhases = dbAddPhases.OpenRecordset("Timecard Options"
With rstAddPhases
.addnew
If IsNull(Me![txtPhase1]) Then
'do nothing
Else
FieldName = "Cost Code_" & Me![txtCustomerJob]
--------->![FieldName] = Me![txtPhase1]
End If
.Update
End With
This, however, is not working & can't find item in table. How can I append to the field using a general variable that I define (such as I was trying to do w/'FieldName'.
Thank you in advance for any help you may offer me.
Set dbAddPhases = CurrentDb
Set rstAddPhases = dbAddPhases.OpenRecordset("Timecard Options"
With rstAddPhases
.addnew
If IsNull(Me![txtPhase1]) Then
'do nothing
Else
FieldName = "Cost Code_" & Me![txtCustomerJob]
--------->![FieldName] = Me![txtPhase1]
End If
.Update
End With
This, however, is not working & can't find item in table. How can I append to the field using a general variable that I define (such as I was trying to do w/'FieldName'.
Thank you in advance for any help you may offer me.