Kamis, 30 Juni 2011

Re: [MS_AccessPros] Data type mismatch in lookup form

 

You are right, I apoligize I forgot about specifiying the field types.
 
RoomTypeID    Autonumber
RoomTypeName   text
 
 
And you were right,
 
    If Not IsNull(Me.RoomTypeID) Then
        strWhere = "RoomTypeID = " & Me.RoomTypeID
    End If
 
Works fine now. Thank you very much.
 

With warm regards,

Arthur Lorenzini| SQL Server/Access Developer l alorenzin@live.com
Office: 605-338-0947| Mobile: 605-857-9137 | Fax: 605-338-0947
 
1316 E. 7th Street
Sioux Falls, SD  57103  
SQL Server Development
Database Adminstration Services
Microsoft Access Development  
Grant Writing TA Services
IT Assessment Services
Software Application Training

From: Duane Hookom <duanehookom@hotmail.com>
To: Access Professionals Yahoo Group <ms_access_professionals@yahoogroups.com>
Sent: Wednesday, June 29, 2011 9:36 PM
Subject: RE: [MS_AccessPros] Data type mismatch in lookup form
Art,You get a "data type mismatch" issue but don't tell us any of the significant data types :-(I expect RoomTypeID might be numeric. If so, try:  strWhere = "RoomTypeID = " & Me.RoomTypeID I would probably just open the form using a Where Condition rather than the recordset stuff.Duane HookomMS Access MVPTo: MS_Access_Professionals@yahoogroups.comFrom: dbalorenzini@yahoo.comDate: Wed, 29 Jun 2011 22:00:41 +0000Subject: [MS_AccessPros] Data type mismatch in lookup form  I have a main form with a combobox called RoomTypeID. When the user double click on the RoomTypeID it should open a form called frmLkpRoomType which allows the user to add or modify Room Type items. This is code behind the double click event:Private Sub RoomTypeID_DblClick(Cancel As Integer)Dim rs As DAO.RecordsetDim strWhere As StringConst strcTargetForm = "frmLkpRoomType"'Set up to search for the current Room Type.If Not IsNull(Me.RoomTypeID) ThenstrWhere = "RoomTypeID = """ &
Me.RoomTypeID & """"End If'Open the editing form.If Not CurrentProject.AllForms(strcTargetForm).IsLoaded ThenDoCmd.OpenForm strcTargetFormEnd IfWith Forms(strcTargetForm)'Save any edits in progress, and make it the active form.If .Dirty Then .Dirty = False.SetFocusIf strWhere <> vbNullString Then'Find the record matching the combo.Set rs = .RecordsetCloners.FindFirst strWhereIf Not rs.NoMatch Then.Bookmark = rs.BookmarkEnd IfElse'Combo was blank, so go to new record.RunCommand acCmdRecordsGoToNewEnd IfEnd WithSet rs = NothingEnd SubThe strWhere is coming back with strWhere="RoomTypeID ="1""But its erroring out on the rs.FindFirst strWhere with a Data Type Mismatch.This snippet I found on Allen Browne site.The form frmLkpRoomType contains two fields called RoomTypeID and RoomTypeNameAny Ideas?Thanks,Art Lorenzini                        [Non-text portions of this message have been removed]------------------------------------Yahoo! Groups
[Non-text portions of this message have been removed]

__._,_.___
Recent Activity:
.

__,_._,___

Tidak ada komentar:

Posting Komentar