On Wed, 24 Dec 2008 06:13:00 -0800, Walter <Walter[ at ]discussions.microsoft.com> wrote:
In the last line you essentially write: i = "abc" If the variable i is an integer, its value can only be a whole 16-bit number, not a string. It appears that what you want is to do a database lookup for some specific integer value, and assign that to your integer variable: i = <some_database_lookup> Fortunately there is a solution for that: the DLookup function. Look it up in the help file.
-Tom. Microsoft Access MVP
[Quoted Text] >I have the following code and I keep getting a type mismatch error. I've >tried every possiblity that I can think of to no avail. I haven't been able >to find anything that seems to relate to my situation. > >Dim strOldPosition As String > Dim strNewPosition As String > Dim intOldPosition As Integer > Dim intNewPosition As Integer > Dim intOldTire As Integer > Dim intNewTire As Integer > > strOldPosition = Me.ActiveControl.Caption > strNewPosition = Nz(Forms!frmUpdateTireLocation!cboNewPosition, 0) > intOldPosition = _ > "Select tblTirePosition.TirePositionID " & _ > "From tblTirePosition " & _ > "Where (((tblTirePosition.TirePosition) = """ & strOldPosition & >"""" & "));" > >The code breaks at the query defining intOldPosition. >tblTirePosition.TirePosition is a text field. What am I missing? >
|