Form

B

bdehning

Steve, this is where I am from 1/8/05

Here is what I tried after your post. back on 1/8/05

CurrentDb.Execute "INSERT INTO [Service Calls Update]([Location
ID],[Checkbox],[Scheduled Service Month])" & _
" VALUES ( " & CheckRef & ",'" & MonthRef & "' )", dbFailOnError

Number of query values and destination fields are not the same. I assume
this has to do with me having only one field for items I want to appear on
the subform. Fields I have on subform are [Scheduled Service Month],
[CheckBox], [Assigned Consultant], [Service Call Number], [Call Type].
[Assigned Consultant] and [Call Type] are Combo Boxes.

IF we get this to work there is a field [Assigned Consultant] on the
Location Update subform that could be used to feed a name to [Assigned
Consultant] on the Service Call Update subform. Then users could leave or
modify as required.

Does this help.

Main Form is Service Frequency Set-up 1-6-05. Location Update is a subform
of the main form. Service Call Update is a subform of the Location Update
Form.
 
S

Steve Schapel

Brian,

As I answered before:
"You forgot to include the Location ID in the VALUES clause".

"Number of query values and destination fields are not the same" refers
to the fact that you have 3 destination fields in your query statement
(i.e. [Location ID], [Checkbox], and [Scheduled Service Month]) and only
2 values to go in there (i.e. CheckRef and MonthRef). Try it like I
showed you on 8/1/05.
 
B

bdehning

Steve, here is what it says now that I tried this!

Mi Access can't find the field "[" referred to in your expression.

CurrentDb.Execute "INSERT INTO [Service Calls Update]([Location
ID],[Checkbox],[Scheduled Service Month])" & _
" VALUES ( " & Me.[Location ID] & "," & CheckRef & ",'" & MonthRef
& "' )", dbFailOnError

Any ideas?

Steve Schapel said:
Brian,

As I answered before:
"You forgot to include the Location ID in the VALUES clause".

"Number of query values and destination fields are not the same" refers
to the fact that you have 3 destination fields in your query statement
(i.e. [Location ID], [Checkbox], and [Scheduled Service Month]) and only
2 values to go in there (i.e. CheckRef and MonthRef). Try it like I
showed you on 8/1/05.

--
Steve Schapel, Microsoft Access MVP
Steve, this is where I am from 1/8/05

Here is what I tried after your post. back on 1/8/05

CurrentDb.Execute "INSERT INTO [Service Calls Update]([Location
ID],[Checkbox],[Scheduled Service Month])" & _
" VALUES ( " & CheckRef & ",'" & MonthRef & "' )", dbFailOnError

Number of query values and destination fields are not the same. I assume
this has to do with me having only one field for items I want to appear on
the subform. Fields I have on subform are [Scheduled Service Month],
[CheckBox], [Assigned Consultant], [Service Call Number], [Call Type].
[Assigned Consultant] and [Call Type] are Combo Boxes.

IF we get this to work there is a field [Assigned Consultant] on the
Location Update subform that could be used to feed a name to [Assigned
Consultant] on the Service Call Update subform. Then users could leave or
modify as required.

Does this help.

Main Form is Service Frequency Set-up 1-6-05. Location Update is a subform
of the main form. Service Call Update is a subform of the Location Update
Form.
 
S

Steve Schapel

Brian,

You seem to have closed up the spaces in the INSERT clause, between the
name of the table and the name of the fields. Again, refer to my
earlier reply. I am not sure whether this might be the cause of the
problem... I would expect Access to be able to handle this, but then
again I have never tried it without the spaces. Good luck.
 
B

bdehning

Steve, here is what I tried again with spaces and same message. WHere di I
still have space problems?

CurrentDb.Execute "INSERT INTO [Service Calls Update] ( [Location ID],
[Checkbox], [Scheduled Service Month] )" & _
" VALUES ( " & Me.[Location ID] & "," & CheckRef & ",'" & MonthRef
& "' )", dbFailOnError

Steve Schapel said:
Brian,

You seem to have closed up the spaces in the INSERT clause, between the
name of the table and the name of the fields. Again, refer to my
earlier reply. I am not sure whether this might be the cause of the
problem... I would expect Access to be able to handle this, but then
again I have never tried it without the spaces. Good luck.

--
Steve Schapel, Microsoft Access MVP
Steve, here is what it says now that I tried this!

Mi Access can't find the field "[" referred to in your expression.

CurrentDb.Execute "INSERT INTO [Service Calls Update]([Location
ID],[Checkbox],[Scheduled Service Month])" & _
" VALUES ( " & Me.[Location ID] & "," & CheckRef & ",'" & MonthRef
& "' )", dbFailOnError

Any ideas?
 
S

Steve Schapel

Brian,

Well, apparently that wasn't the answer!

Ok, just to re-confirm:

1. You have a table named Service Calls Update.

2. In this table there are these 3 fields:
Location ID which is a number data type
Checkbox which is a Yes/No data type
Scheduled Service Month which is a text data type.

3. There is a field/control named Location ID on the form that this code
is being run from.

4. You have a Boolean variable called CheckRef declared in this subroutine.
(please review what value is assigned to this variable)

5. You have a String variable named MonthRef declared in this subroutine.
(please review what value is assigned to this variable)

I don't know what the problem is, but it is likely to be an error with
syntax or with an expression in your code.
 
Top