One field from Existing Record Blanked Out When Appending New Reco

L

LEH

The issue: When I append a new record based on values obtained from a form's
text box and combo box values into an external db table, one field ("Role")
in an existing record in the table is blanked out. Can someone please share
why this might be happening?
The code:

db.Execute ("INSERT INTO EmplInfo ( EmployeeName, Unit, Division, SSN, Role,
emailaddress ) IN '" & Me!TextPath & "'" & _
" SELECT '" & Me!TextName & "' AS EMPLName, '" & Me!TextUnit
& "' AS EMPLUnit, '" & Me!ComboDivision & "' as EMPLDiv, '" & Me!TextSSN & "'
as EMPLID,'" & Me!ComboRole.Value & "' as EMPLRole,'" & Me!TextEmail &
Me!Combo17 & "' AS Address;")

Set db = Nothing
 
J

Jeanette Cunningham

Debug the query to find the values it is picking up from the form.
Dim strSQL as String

strSQL = ("INSERT INTO EmplInfo ( EmployeeName, Unit, Division, SSN, Role,
emailaddress ) IN '" & Me!TextPath & "'" & _
" SELECT '" & Me!TextName & "' AS EMPLName, '" & Me!TextUnit
& "' AS EMPLUnit, '" & Me!ComboDivision & "' as EMPLDiv, '" & Me!TextSSN &
"'
as EMPLID,'" & Me!ComboRole.Value & "' as EMPLRole,'" & Me!TextEmail &
Me!Combo17 & "' AS Address;")
Debug.Print strSQL


run your form
open the immediate window Ctl | G
see what the value for Role is.

Jeanette Cunningham
 
L

LEH

Thanks for your quick reply. I found the problem. After the query ran I was
blanking out the forms entry boxes and somehow picked up the name from the
actual table field. Rookie mistake. Thanks again!
 
Top