Re: Data Type mismatch with autonumber
- From: "Rob Oldfield" <blah@xxxxxxxx>
- Date: Wed, 21 Dec 2005 22:25:59 -0000
Hmmm. Rather than use a msgbox to grab the text that you've built... try
adding a breakpoint (Debug, Toggle Breakpoint) on the next line after your
string building (provided that it's not just a dim statement or similar).
Then run the code by opening the form and doing whatever it is that triggers
it. The code will stop at that line.
Next open the immediate window (View, Immediate Window). In there, type
?cmd2.commandtext and hit enter. That will give you your built string.
Copy that and paste it into the SQL view of a new query (you might need to
lose the opening and closing speech marks). Start a new query, then View,
SQL View, delete whatever is already there and then paste your text. Then
try switching to design view. If that works, try running the query and see
if you get a more meaningful error.
What does that give you?
"Aranyx" <aranyx@xxxxxxxxx> wrote in message
news:1135202386.085610.305910@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
> Thanks Rob. That seems to work fine. Only problem was that was that I
> abridged the SQL statement because I update 12 fields and I didn't feel
> like retyping everything in the messagebox. I suppose that was pretty
> dumb of me though, because it would appear the error is somewhere in
> there.
>
> Another thing I tried creating a recordset and selecting using the same
> where clause and that worked fine. It also didn't work when I tried a
> criteria of another unique field from the table. So the error I would
> agree with you Rob not to trust the error message.
>
> I can try posting my VBScript, since the error will probably be in
> there.
>
> cmd2.CommandText = "UPDATE Assets " _
> & "SET Assets.LabStaffUse = 'Disposed', " _
> & "Assets.Status = 'Disposed-Internal', " _
> & "Assets.DateModified = DATE(), " _
> & "Assets.PhysicalInventoryDate = DATE(), " _
> & "Assets.UserUpdated = '" & txtUser.Value & "'," _
> & "Assets.EmployeeNumber = '" & cmbCampus.Value &
> txtRoomNumber.Value & "', " _
> & "Assets.Locked = 'No', " _
> & "Assets.EligibleForRefresh = 'No', " _
> & "Assets.LastName = '" & strLast & "'," _
> & "Assets.FirstName = '" & strFirst & "'," _
> & "Assets.CustodianName = '" & txtCustodian.Value & "', " _
> & "Assets.InventoryStatus = 'Disposed', " _
> & "Assets.RecordStatus = 'No' " _
> & "WHERE Assets.ID = " + strID + ";"
>
> Thanks for the help.
>
.
- References:
- Data Type mismatch with autonumber
- From: Aranyx
- Re: Data Type mismatch with autonumber
- From: Rob Oldfield
- Re: Data Type mismatch with autonumber
- From: Aranyx
- Data Type mismatch with autonumber
- Prev by Date: Re: Data Type mismatch with autonumber
- Next by Date: Re: Data Type mismatch with autonumber
- Previous by thread: Re: Data Type mismatch with autonumber
- Next by thread: Re: Help With Select Statement
- Index(es):
Relevant Pages
|