G
Guest
I have a table [T_LocTypes] with 3 fields:
* [LocTypeCode] - AutoNumber Primary Key
* [LocActivityType] - Byte (1 of 54 types of organizations)
* [LocType] - String/50 - things like "Fire Station", "Water Treatment
Plant", "Jail"
I have a form [F_NewLocTypes]. Two controls on the form are:
* [ACTIVITY_CODE] - one value for organization type chosen in a list box on
an earlier form
* [txtNewLocType] - String entered by user describing main use of location -
"Office", any of the LocType types.
I have a button on the form [btnSaveNewLocType] that has this On_Click
procedure (not showing un-involved code):
_______________________
Private Sub btnSaveNewLocType_Click()
Dim strSQLInsert As String
strSQLInsert = "INSERT INTO TYbf_LocType(LocActivityType, LocType)
SELECT [Forms]![FYbf_Locations_NewType_3].[ACTIVITY_CODE],
[Forms]![FYbf_Locations_NewType_3].[txtNewFacilityType]"
DoCmd.RunSQL strSQLInsert
End Sub
__________________
After I enter a string in [txtNewFacilityType] I click the Save button. This
saves a new record - but there is no value in [LocType] - there is a value in
[LocActivityType].
I added this code after the "Dim strSQLInsert As String" statement to try to
find out what's going on:
____________________________
Dim LocActivityType As Byte
Dim LocType As String * 50
LocActivityType = Forms!FYbf_Locations_NewType_3!ACTIVITY_CODE
Debug.Print LocActivityType
LocType = Forms!FYbf_Locations_NewType_3!txtNewFacilityType
Debug.Print LocType
____________________
I see the correct [LocActivityType] value show up in the Immediate Window,
but when I get to the "LocType = ...!txtNewFacilityType" line I get an
"Invalid Use of Null Statement".
But there is a string entered in that control on the form.
Anyone see how I'm shooting myself in the foot?
TIA - John D
* [LocTypeCode] - AutoNumber Primary Key
* [LocActivityType] - Byte (1 of 54 types of organizations)
* [LocType] - String/50 - things like "Fire Station", "Water Treatment
Plant", "Jail"
I have a form [F_NewLocTypes]. Two controls on the form are:
* [ACTIVITY_CODE] - one value for organization type chosen in a list box on
an earlier form
* [txtNewLocType] - String entered by user describing main use of location -
"Office", any of the LocType types.
I have a button on the form [btnSaveNewLocType] that has this On_Click
procedure (not showing un-involved code):
_______________________
Private Sub btnSaveNewLocType_Click()
Dim strSQLInsert As String
strSQLInsert = "INSERT INTO TYbf_LocType(LocActivityType, LocType)
SELECT [Forms]![FYbf_Locations_NewType_3].[ACTIVITY_CODE],
[Forms]![FYbf_Locations_NewType_3].[txtNewFacilityType]"
DoCmd.RunSQL strSQLInsert
End Sub
__________________
After I enter a string in [txtNewFacilityType] I click the Save button. This
saves a new record - but there is no value in [LocType] - there is a value in
[LocActivityType].
I added this code after the "Dim strSQLInsert As String" statement to try to
find out what's going on:
____________________________
Dim LocActivityType As Byte
Dim LocType As String * 50
LocActivityType = Forms!FYbf_Locations_NewType_3!ACTIVITY_CODE
Debug.Print LocActivityType
LocType = Forms!FYbf_Locations_NewType_3!txtNewFacilityType
Debug.Print LocType
____________________
I see the correct [LocActivityType] value show up in the Immediate Window,
but when I get to the "LocType = ...!txtNewFacilityType" line I get an
"Invalid Use of Null Statement".
But there is a string entered in that control on the form.
Anyone see how I'm shooting myself in the foot?
TIA - John D