DoCmd.RunSQL "UPDATE tblDatabase

J

Julia82

Dim varReturn As Variant
varReturn = DLookup("[User1]", "tblDatabase", "[UID]= " & Me.UID)

If IsNull(varReturn) Then

DoCmd.RunSQL "UPDATE tblDatabase SET User1='" & [TempVars]![varUser] & "'"

End If

The following command line is updating me the whole table, instead of
updating only the selected record.

How can I do to just modify the current record?
 
J

Jack Leach

You need to include a Where clause, otherwise the entire table gets updated.

UPDATE tblDatabase Set User1='" & [TempVars]![varUser] & "' " & _
"WHERE [SomeIDField] = SomeCriteria"


hth

--
Jack Leach
www.tristatemachine.com

"I haven''t failed, I''ve found ten thousand ways that don''t work."
-Thomas Edison (1847-1931)
 
J

Julia82

Ok, and I am trying to do this:

Dim varReturn As Variant
varReturn = DLookup("[User1]", "tblDatabase", "[UID]=" & Me.UID)

If IsNull(varReturn) Then

DoCmd.RunSQL "UPDATE tblDatabase SET User1='" &
[TempVars]![varUtilizator] & "' WHERE UID = ' " & Me.UID & " ' "

or even

DoCmd.RunSQL "UPDATE tblDatabase SET User1='" & [TempVars]![varUtilizator] &
"' WHERE UID =UID "

That changes the whole table, not just the record I editing.

Thanks.


Jack Leach said:
You need to include a Where clause, otherwise the entire table gets updated.

UPDATE tblDatabase Set User1='" & [TempVars]![varUser] & "' " & _
"WHERE [SomeIDField] = SomeCriteria"


hth

--
Jack Leach
www.tristatemachine.com

"I haven''t failed, I''ve found ten thousand ways that don''t work."
-Thomas Edison (1847-1931)



Julia82 said:
Dim varReturn As Variant
varReturn = DLookup("[User1]", "tblDatabase", "[UID]= " & Me.UID)

If IsNull(varReturn) Then

DoCmd.RunSQL "UPDATE tblDatabase SET User1='" & [TempVars]![varUser] & "'"

End If

The following command line is updating me the whole table, instead of
updating only the selected record.

How can I do to just modify the current record?
 
J

Jack Leach

DoCmd.RunSQL "UPDATE tblDatabase SET User1='" &
[TempVars]![varUtilizator] & "' WHERE UID = ' " & Me.UID & " ' "

This looks almost correct. You have an extra set of single quotes in the
where statement. Change it to this instead:

DoCmd.RunSQL "UPDATE tblDatabase SET User1='" & [TempVars]![varUtilizator] &
" WHERE UID = '" & Me.UID & "'"


Be sure to include the space between the quote and WHERE, it needs to be
there. As for the ' " combinations surrounding Me.UID, I took those out,
though it makes it more difficult to read, those spaces cannot be there.

That should do it, assuming your field name is UID, and your UID datatype is
a text data. If it is number, you need to go about it a little differently
and remove the quotes around the value...

DoCmd.RunSQL "UPDATE tblDatabase SET User1='" & [TempVars]![varUtilizator] &
" WHERE UID = " Me.UID

hth
--
Jack Leach
www.tristatemachine.com

"I haven''t failed, I''ve found ten thousand ways that don''t work."
-Thomas Edison (1847-1931)



Julia82 said:
Ok, and I am trying to do this:

Dim varReturn As Variant
varReturn = DLookup("[User1]", "tblDatabase", "[UID]=" & Me.UID)

If IsNull(varReturn) Then

DoCmd.RunSQL "UPDATE tblDatabase SET User1='" &
[TempVars]![varUtilizator] & "' WHERE UID = ' " & Me.UID & " ' "

or even

DoCmd.RunSQL "UPDATE tblDatabase SET User1='" & [TempVars]![varUtilizator] &
"' WHERE UID =UID "

That changes the whole table, not just the record I editing.

Thanks.


Jack Leach said:
You need to include a Where clause, otherwise the entire table gets updated.

UPDATE tblDatabase Set User1='" & [TempVars]![varUser] & "' " & _
"WHERE [SomeIDField] = SomeCriteria"


hth

--
Jack Leach
www.tristatemachine.com

"I haven''t failed, I''ve found ten thousand ways that don''t work."
-Thomas Edison (1847-1931)



Julia82 said:
Dim varReturn As Variant
varReturn = DLookup("[User1]", "tblDatabase", "[UID]= " & Me.UID)

If IsNull(varReturn) Then

DoCmd.RunSQL "UPDATE tblDatabase SET User1='" & [TempVars]![varUser] & "'"

End If

The following command line is updating me the whole table, instead of
updating only the selected record.

How can I do to just modify the current record?
 
J

Julia82

UID = ID in my table that is an autonumber.

So I assume, that to be correct I must use:

DoCmd.RunSQL "UPDATE tblDatabase SET User1='" & [TempVars]![varUtilizator] &
" WHERE UID = " Me.UID

But there is a problem when I enter Me.UID and I run the form. Gives me an
error. I am getting a random error. Sometime is working, sometimes is not.

I must be doing something wrong with my code.




Jack Leach said:
DoCmd.RunSQL "UPDATE tblDatabase SET User1='" &
[TempVars]![varUtilizator] & "' WHERE UID = ' " & Me.UID & " ' "

This looks almost correct. You have an extra set of single quotes in the
where statement. Change it to this instead:

DoCmd.RunSQL "UPDATE tblDatabase SET User1='" & [TempVars]![varUtilizator] &
" WHERE UID = '" & Me.UID & "'"


Be sure to include the space between the quote and WHERE, it needs to be
there. As for the ' " combinations surrounding Me.UID, I took those out,
though it makes it more difficult to read, those spaces cannot be there.

That should do it, assuming your field name is UID, and your UID datatype is
a text data. If it is number, you need to go about it a little differently
and remove the quotes around the value...

DoCmd.RunSQL "UPDATE tblDatabase SET User1='" & [TempVars]![varUtilizator] &
" WHERE UID = " Me.UID

hth
--
Jack Leach
www.tristatemachine.com

"I haven''t failed, I''ve found ten thousand ways that don''t work."
-Thomas Edison (1847-1931)



Julia82 said:
Ok, and I am trying to do this:

Dim varReturn As Variant
varReturn = DLookup("[User1]", "tblDatabase", "[UID]=" & Me.UID)

If IsNull(varReturn) Then

DoCmd.RunSQL "UPDATE tblDatabase SET User1='" &
[TempVars]![varUtilizator] & "' WHERE UID = ' " & Me.UID & " ' "

or even

DoCmd.RunSQL "UPDATE tblDatabase SET User1='" & [TempVars]![varUtilizator] &
"' WHERE UID =UID "

That changes the whole table, not just the record I editing.

Thanks.


Jack Leach said:
You need to include a Where clause, otherwise the entire table gets updated.

UPDATE tblDatabase Set User1='" & [TempVars]![varUser] & "' " & _
"WHERE [SomeIDField] = SomeCriteria"


hth

--
Jack Leach
www.tristatemachine.com

"I haven''t failed, I''ve found ten thousand ways that don''t work."
-Thomas Edison (1847-1931)



:

Dim varReturn As Variant
varReturn = DLookup("[User1]", "tblDatabase", "[UID]= " & Me.UID)

If IsNull(varReturn) Then

DoCmd.RunSQL "UPDATE tblDatabase SET User1='" & [TempVars]![varUser] & "'"

End If

The following command line is updating me the whole table, instead of
updating only the selected record.

How can I do to just modify the current record?
 
J

Jeanette Cunningham

There is a small error on this line
" WHERE UID = " Me.UID

should be
" WHERE UID = " & Me.UID & ""


Jeanette Cunningham MS Access MVP -- Melbourne Victoria Australia



Julia82 said:
UID = ID in my table that is an autonumber.

So I assume, that to be correct I must use:

DoCmd.RunSQL "UPDATE tblDatabase SET User1='" & [TempVars]![varUtilizator]
&
" WHERE UID = " Me.UID

But there is a problem when I enter Me.UID and I run the form. Gives me an
error. I am getting a random error. Sometime is working, sometimes is not.

I must be doing something wrong with my code.




Jack Leach said:
DoCmd.RunSQL "UPDATE tblDatabase SET User1='" &
[TempVars]![varUtilizator] & "' WHERE UID = ' " & Me.UID & " ' "

This looks almost correct. You have an extra set of single quotes in the
where statement. Change it to this instead:

DoCmd.RunSQL "UPDATE tblDatabase SET User1='" &
[TempVars]![varUtilizator] &
" WHERE UID = '" & Me.UID & "'"


Be sure to include the space between the quote and WHERE, it needs to be
there. As for the ' " combinations surrounding Me.UID, I took those out,
though it makes it more difficult to read, those spaces cannot be there.

That should do it, assuming your field name is UID, and your UID datatype
is
a text data. If it is number, you need to go about it a little
differently
and remove the quotes around the value...

DoCmd.RunSQL "UPDATE tblDatabase SET User1='" &
[TempVars]![varUtilizator] &
" WHERE UID = " Me.UID

hth
--
Jack Leach
www.tristatemachine.com

"I haven''t failed, I''ve found ten thousand ways that don''t work."
-Thomas Edison (1847-1931)



Julia82 said:
Ok, and I am trying to do this:

Dim varReturn As Variant
varReturn = DLookup("[User1]", "tblDatabase", "[UID]=" & Me.UID)

If IsNull(varReturn) Then

DoCmd.RunSQL "UPDATE tblDatabase SET User1='" &
[TempVars]![varUtilizator] & "' WHERE UID = ' " & Me.UID & " ' "

or even

DoCmd.RunSQL "UPDATE tblDatabase SET User1='" &
[TempVars]![varUtilizator] &
"' WHERE UID =UID "

That changes the whole table, not just the record I editing.

Thanks.


:

You need to include a Where clause, otherwise the entire table gets
updated.

UPDATE tblDatabase Set User1='" & [TempVars]![varUser] & "' " & _
"WHERE [SomeIDField] = SomeCriteria"


hth

--
Jack Leach
www.tristatemachine.com

"I haven''t failed, I''ve found ten thousand ways that don''t work."
-Thomas Edison (1847-1931)



:

Dim varReturn As Variant
varReturn = DLookup("[User1]", "tblDatabase", "[UID]= " & Me.UID)

If IsNull(varReturn) Then

DoCmd.RunSQL "UPDATE tblDatabase SET User1='" &
[TempVars]![varUser] & "'"

End If

The following command line is updating me the whole table, instead
of
updating only the selected record.

How can I do to just modify the current record?
 
J

Jeanette Cunningham

A more helpful way is to set it up like this.

Dim strSQL As String

strSQL = "UPDATE tblDatabase SET User1='" & [TempVars]![varUtilizator] &
" WHERE UID = " & Me.UID & ""
Debug.Print strSQL

DoCmd.RunSQL strSQL


Now you click the button that runs that sub.
Open the immediate window and see what access got for strSQL

You can copy and paste that sql string into the sql view of a new query and
switch to datasheet view.
This will usually show you the errors with the sql string.


Jeanette Cunningham MS Access MVP -- Melbourne Victoria Australia


Jeanette Cunningham said:
There is a small error on this line
" WHERE UID = " Me.UID

should be
" WHERE UID = " & Me.UID & ""


Jeanette Cunningham MS Access MVP -- Melbourne Victoria Australia



Julia82 said:
UID = ID in my table that is an autonumber.

So I assume, that to be correct I must use:

DoCmd.RunSQL "UPDATE tblDatabase SET User1='" &
[TempVars]![varUtilizator] &
" WHERE UID = " Me.UID

But there is a problem when I enter Me.UID and I run the form. Gives me
an
error. I am getting a random error. Sometime is working, sometimes is
not.

I must be doing something wrong with my code.




Jack Leach said:
DoCmd.RunSQL "UPDATE tblDatabase SET User1='" &
[TempVars]![varUtilizator] & "' WHERE UID = ' " & Me.UID & " ' "

This looks almost correct. You have an extra set of single quotes in
the
where statement. Change it to this instead:

DoCmd.RunSQL "UPDATE tblDatabase SET User1='" &
[TempVars]![varUtilizator] &
" WHERE UID = '" & Me.UID & "'"


Be sure to include the space between the quote and WHERE, it needs to be
there. As for the ' " combinations surrounding Me.UID, I took those
out,
though it makes it more difficult to read, those spaces cannot be there.

That should do it, assuming your field name is UID, and your UID
datatype is
a text data. If it is number, you need to go about it a little
differently
and remove the quotes around the value...

DoCmd.RunSQL "UPDATE tblDatabase SET User1='" &
[TempVars]![varUtilizator] &
" WHERE UID = " Me.UID

hth
--
Jack Leach
www.tristatemachine.com

"I haven''t failed, I''ve found ten thousand ways that don''t work."
-Thomas Edison (1847-1931)



:

Ok, and I am trying to do this:

Dim varReturn As Variant
varReturn = DLookup("[User1]", "tblDatabase", "[UID]=" & Me.UID)

If IsNull(varReturn) Then

DoCmd.RunSQL "UPDATE tblDatabase SET User1='" &
[TempVars]![varUtilizator] & "' WHERE UID = ' " & Me.UID & " ' "

or even

DoCmd.RunSQL "UPDATE tblDatabase SET User1='" &
[TempVars]![varUtilizator] &
"' WHERE UID =UID "

That changes the whole table, not just the record I editing.

Thanks.


:

You need to include a Where clause, otherwise the entire table gets
updated.

UPDATE tblDatabase Set User1='" & [TempVars]![varUser] & "' " & _
"WHERE [SomeIDField] = SomeCriteria"


hth

--
Jack Leach
www.tristatemachine.com

"I haven''t failed, I''ve found ten thousand ways that don''t work."
-Thomas Edison (1847-1931)



:

Dim varReturn As Variant
varReturn = DLookup("[User1]", "tblDatabase", "[UID]= " & Me.UID)

If IsNull(varReturn) Then

DoCmd.RunSQL "UPDATE tblDatabase SET User1='" &
[TempVars]![varUser] & "'"

End If

The following command line is updating me the whole table, instead
of
updating only the selected record.

How can I do to just modify the current record?
 
J

John W. Vinson

UID = ID in my table that is an autonumber.

So I assume, that to be correct I must use:

DoCmd.RunSQL "UPDATE tblDatabase SET User1='" & [TempVars]![varUtilizator] &
" WHERE UID = " Me.UID

But there is a problem when I enter Me.UID and I run the form. Gives me an
error. I am getting a random error. Sometime is working, sometimes is not.

I must be doing something wrong with my code.

I'm surprised it compiled at all! You're missing an ampersand:

DoCmd.RunSQL "UPDATE tblDatabase SET User1='" & [TempVars]![varUtilizator] &
" WHERE UID = " & Me.UID
 
J

Julia82

Somehow I found out what the problem was. Is still not working, but I tking I
will get this going now.

Somehow I managed to link two ID of two tables that had the same name (UID)
and a bunch of error happened. Good thing I figured that out.

I hope I'll solve this. If not... I'll get back to you if you still have the
patience :)
 
J

Julia82

Oh my God! It's working! There are over 24 hours I'm trying in front of the
PC to get this code going. (With a little theatre pause this evening :p)

Janette, that was the error like you told me. Thanks a million! I learned so
much from you guys! :)

Jeanette Cunningham said:
There is a small error on this line
" WHERE UID = " Me.UID

should be
" WHERE UID = " & Me.UID & ""


Jeanette Cunningham MS Access MVP -- Melbourne Victoria Australia



Julia82 said:
UID = ID in my table that is an autonumber.

So I assume, that to be correct I must use:

DoCmd.RunSQL "UPDATE tblDatabase SET User1='" & [TempVars]![varUtilizator]
&
" WHERE UID = " Me.UID

But there is a problem when I enter Me.UID and I run the form. Gives me an
error. I am getting a random error. Sometime is working, sometimes is not.

I must be doing something wrong with my code.




Jack Leach said:
DoCmd.RunSQL "UPDATE tblDatabase SET User1='" &
[TempVars]![varUtilizator] & "' WHERE UID = ' " & Me.UID & " ' "

This looks almost correct. You have an extra set of single quotes in the
where statement. Change it to this instead:

DoCmd.RunSQL "UPDATE tblDatabase SET User1='" &
[TempVars]![varUtilizator] &
" WHERE UID = '" & Me.UID & "'"


Be sure to include the space between the quote and WHERE, it needs to be
there. As for the ' " combinations surrounding Me.UID, I took those out,
though it makes it more difficult to read, those spaces cannot be there.

That should do it, assuming your field name is UID, and your UID datatype
is
a text data. If it is number, you need to go about it a little
differently
and remove the quotes around the value...

DoCmd.RunSQL "UPDATE tblDatabase SET User1='" &
[TempVars]![varUtilizator] &
" WHERE UID = " Me.UID

hth
--
Jack Leach
www.tristatemachine.com

"I haven''t failed, I''ve found ten thousand ways that don''t work."
-Thomas Edison (1847-1931)



:

Ok, and I am trying to do this:

Dim varReturn As Variant
varReturn = DLookup("[User1]", "tblDatabase", "[UID]=" & Me.UID)

If IsNull(varReturn) Then

DoCmd.RunSQL "UPDATE tblDatabase SET User1='" &
[TempVars]![varUtilizator] & "' WHERE UID = ' " & Me.UID & " ' "

or even

DoCmd.RunSQL "UPDATE tblDatabase SET User1='" &
[TempVars]![varUtilizator] &
"' WHERE UID =UID "

That changes the whole table, not just the record I editing.

Thanks.


:

You need to include a Where clause, otherwise the entire table gets
updated.

UPDATE tblDatabase Set User1='" & [TempVars]![varUser] & "' " & _
"WHERE [SomeIDField] = SomeCriteria"


hth

--
Jack Leach
www.tristatemachine.com

"I haven''t failed, I''ve found ten thousand ways that don''t work."
-Thomas Edison (1847-1931)



:

Dim varReturn As Variant
varReturn = DLookup("[User1]", "tblDatabase", "[UID]= " & Me.UID)

If IsNull(varReturn) Then

DoCmd.RunSQL "UPDATE tblDatabase SET User1='" &
[TempVars]![varUser] & "'"

End If

The following command line is updating me the whole table, instead
of
updating only the selected record.

How can I do to just modify the current record?


.
 
J

Jeanette Cunningham

You're very welcome.

Jeanette Cunningham MS Access MVP -- Melbourne Victoria Australia

Julia82 said:
Oh my God! It's working! There are over 24 hours I'm trying in front of
the
PC to get this code going. (With a little theatre pause this evening :p)

Janette, that was the error like you told me. Thanks a million! I learned
so
much from you guys! :)

Jeanette Cunningham said:
There is a small error on this line
" WHERE UID = " Me.UID

should be
" WHERE UID = " & Me.UID & ""


Jeanette Cunningham MS Access MVP -- Melbourne Victoria Australia



Julia82 said:
UID = ID in my table that is an autonumber.

So I assume, that to be correct I must use:

DoCmd.RunSQL "UPDATE tblDatabase SET User1='" &
[TempVars]![varUtilizator]
&
" WHERE UID = " Me.UID

But there is a problem when I enter Me.UID and I run the form. Gives me
an
error. I am getting a random error. Sometime is working, sometimes is
not.

I must be doing something wrong with my code.




:

DoCmd.RunSQL "UPDATE tblDatabase SET User1='" &
[TempVars]![varUtilizator] & "' WHERE UID = ' " & Me.UID & " ' "

This looks almost correct. You have an extra set of single quotes in
the
where statement. Change it to this instead:

DoCmd.RunSQL "UPDATE tblDatabase SET User1='" &
[TempVars]![varUtilizator] &
" WHERE UID = '" & Me.UID & "'"


Be sure to include the space between the quote and WHERE, it needs to
be
there. As for the ' " combinations surrounding Me.UID, I took those
out,
though it makes it more difficult to read, those spaces cannot be
there.

That should do it, assuming your field name is UID, and your UID
datatype
is
a text data. If it is number, you need to go about it a little
differently
and remove the quotes around the value...

DoCmd.RunSQL "UPDATE tblDatabase SET User1='" &
[TempVars]![varUtilizator] &
" WHERE UID = " Me.UID

hth
--
Jack Leach
www.tristatemachine.com

"I haven''t failed, I''ve found ten thousand ways that don''t work."
-Thomas Edison (1847-1931)



:

Ok, and I am trying to do this:

Dim varReturn As Variant
varReturn = DLookup("[User1]", "tblDatabase", "[UID]=" & Me.UID)

If IsNull(varReturn) Then

DoCmd.RunSQL "UPDATE tblDatabase SET User1='" &
[TempVars]![varUtilizator] & "' WHERE UID = ' " & Me.UID & " ' "

or even

DoCmd.RunSQL "UPDATE tblDatabase SET User1='" &
[TempVars]![varUtilizator] &
"' WHERE UID =UID "

That changes the whole table, not just the record I editing.

Thanks.


:

You need to include a Where clause, otherwise the entire table
gets
updated.

UPDATE tblDatabase Set User1='" & [TempVars]![varUser] & "' " & _
"WHERE [SomeIDField] = SomeCriteria"


hth

--
Jack Leach
www.tristatemachine.com

"I haven''t failed, I''ve found ten thousand ways that don''t
work."
-Thomas Edison (1847-1931)



:

Dim varReturn As Variant
varReturn = DLookup("[User1]", "tblDatabase", "[UID]= " &
Me.UID)

If IsNull(varReturn) Then

DoCmd.RunSQL "UPDATE tblDatabase SET User1='" &
[TempVars]![varUser] & "'"

End If

The following command line is updating me the whole table,
instead
of
updating only the selected record.

How can I do to just modify the current record?


.
 
J

Jack Leach

Hi Jeanette,

I've never seen a ZLS appended to the end of a number in an SQL, may I ask
what purpose this serves?

" WHERE NumField = " & Me.NumVal & ""

(I assume thats a set of double-quotes, correct?)

--
Jack Leach
www.tristatemachine.com

"I haven''t failed, I''ve found ten thousand ways that don''t work."
-Thomas Edison (1847-1931)



Jeanette Cunningham said:
There is a small error on this line
" WHERE UID = " Me.UID

should be
" WHERE UID = " & Me.UID & ""


Jeanette Cunningham MS Access MVP -- Melbourne Victoria Australia



Julia82 said:
UID = ID in my table that is an autonumber.

So I assume, that to be correct I must use:

DoCmd.RunSQL "UPDATE tblDatabase SET User1='" & [TempVars]![varUtilizator]
&
" WHERE UID = " Me.UID

But there is a problem when I enter Me.UID and I run the form. Gives me an
error. I am getting a random error. Sometime is working, sometimes is not.

I must be doing something wrong with my code.




Jack Leach said:
DoCmd.RunSQL "UPDATE tblDatabase SET User1='" &
[TempVars]![varUtilizator] & "' WHERE UID = ' " & Me.UID & " ' "

This looks almost correct. You have an extra set of single quotes in the
where statement. Change it to this instead:

DoCmd.RunSQL "UPDATE tblDatabase SET User1='" &
[TempVars]![varUtilizator] &
" WHERE UID = '" & Me.UID & "'"


Be sure to include the space between the quote and WHERE, it needs to be
there. As for the ' " combinations surrounding Me.UID, I took those out,
though it makes it more difficult to read, those spaces cannot be there.

That should do it, assuming your field name is UID, and your UID datatype
is
a text data. If it is number, you need to go about it a little
differently
and remove the quotes around the value...

DoCmd.RunSQL "UPDATE tblDatabase SET User1='" &
[TempVars]![varUtilizator] &
" WHERE UID = " Me.UID

hth
--
Jack Leach
www.tristatemachine.com

"I haven''t failed, I''ve found ten thousand ways that don''t work."
-Thomas Edison (1847-1931)



:

Ok, and I am trying to do this:

Dim varReturn As Variant
varReturn = DLookup("[User1]", "tblDatabase", "[UID]=" & Me.UID)

If IsNull(varReturn) Then

DoCmd.RunSQL "UPDATE tblDatabase SET User1='" &
[TempVars]![varUtilizator] & "' WHERE UID = ' " & Me.UID & " ' "

or even

DoCmd.RunSQL "UPDATE tblDatabase SET User1='" &
[TempVars]![varUtilizator] &
"' WHERE UID =UID "

That changes the whole table, not just the record I editing.

Thanks.


:

You need to include a Where clause, otherwise the entire table gets
updated.

UPDATE tblDatabase Set User1='" & [TempVars]![varUser] & "' " & _
"WHERE [SomeIDField] = SomeCriteria"


hth

--
Jack Leach
www.tristatemachine.com

"I haven''t failed, I''ve found ten thousand ways that don''t work."
-Thomas Edison (1847-1931)



:

Dim varReturn As Variant
varReturn = DLookup("[User1]", "tblDatabase", "[UID]= " & Me.UID)

If IsNull(varReturn) Then

DoCmd.RunSQL "UPDATE tblDatabase SET User1='" &
[TempVars]![varUser] & "'"

End If

The following command line is updating me the whole table, instead
of
updating only the selected record.

How can I do to just modify the current record?


.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

FileSystemObject causing refresh malfunction 5
error 3061 1
Can't Update Database 10
RecordCount Property (ADO) 3
DoCMD.RunSQL error 2
Update Query Problem 2
On Change Update Subform 1
How do I do this in VBA? 5

Top