Hello Steel,
Glad to hear you have found your own solutions on this issue. I think there
is no method to improve this because the fields are not indexed.
I think the key point in my suggestions is "Me![Combo4].Text" which is
actually a string of GUID like {25D37643-36CE-4EDD-8A86-4E36968F48FD}. If I
use Me![Combo4] I will get errors. I think this shall work both in main
form and subform though I only tested in subform. The code is in
Afterupdate event function of combo4.
Best Regards,
Peter Yang
MCSE2000/2003, MCSA, MCDBA
Microsoft Online Partner Support
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
=====================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
--------------------
| Thread-Topic: Referencing GUID
| thread-index: AcXLoPWdRglRdVTVQ6a3dc47VF3Esw==
| X-WBNR-Posting-Host: 220.245.178.137
| From: "=?Utf-8?B?c3RlZWw=?=" <
[email protected]>
| References: <
[email protected]>
<
[email protected]>
<
[email protected]>
<
[email protected]>
| Subject: RE: Referencing GUID
| Date: Fri, 7 Oct 2005 17:41:02 -0700
| Lines: 220
| Message-ID: <
[email protected]>
| MIME-Version: 1.0
| Content-Type: text/plain;
| charset="Utf-8"
| Content-Transfer-Encoding: 7bit
| X-Newsreader: Microsoft CDO for Windows 2000
| Content-Class: urn:content-classes:message
| Importance: normal
| Priority: normal
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.0
| Newsgroups: microsoft.public.access.adp.sqlserver
| NNTP-Posting-Host: TK2MSFTNGXA03.phx.gbl 10.40.2.250
| Path: TK2MSFTNGXA01.phx.gbl!TK2MSFTNGXA03.phx.gbl
| Xref: TK2MSFTNGXA01.phx.gbl microsoft.public.access.adp.sqlserver:5798
| X-Tomcat-NG: microsoft.public.access.adp.sqlserver
|
| Thanks for your reply. Unfortunately I couldn't get it to work - maybe
due
| the guid's or using sub-form information to find a record on the main
form.
| Anyway I ended up using GotoRecord, and instead of trying to locate the
appr
| record by referencing the guid I used two different fields of the record
and
| using Recordset did a Count until I found the record where the two fields
| were located.
|
| Here is the code I used. If you have any ideas to make the code perform
more
| effeciently that would be great.
| - frm_Asset_Project is the main form
| - everthing else references the sub-form.
|
|
| Private Sub fldMachine_ID_DblClick(Cancel As Integer)
|
| Dim conn As New ADODB.Connection
| Dim cmd As New ADODB.Command
| Dim rs As ADODB.Recordset
| Dim strSQL As String
| Dim count As Integer
|
| 'SQL_Connection
| On Error GoTo fldMachine_ID_DblClick_Error
|
| conn.Open CurrentProject.Connection
| Set cmd.ActiveConnection = conn
|
| 'Employee Count
| strSQL = "SELECT ProjectCode,AssetIdentifier FROM qryAsset_Project"
|
| cmd.CommandText = strSQL
| cmd.CommandType = adCmdText
| Set rs = cmd.Execute
|
| 'set count = 0
| count = 0
| If rs.State = adStateClosed Then
| 'no connection made
| GoTo fldMachine_ID_DblClick_Error
| Else
| Do While Not rs.EOF
| count = count + 1
| If Me.ProjectCode = rs("ProjectCode") Then
| If Me.AssetIdentifier = rs("AssetIdentifier") Then
| DoCmd.GoToRecord acDataForm, "frm_Asset_Project", acGoTo,
| count
| Exit Sub
| End If
| End If
| rs.MoveNext
| Loop
| End If
|
| fldMachine_ID_DblClick_Exit:
| Set rs = Nothing
| Set cmd = Nothing
| conn.Close
| Set conn = Nothing
| Exit Sub
|
| fldMachine_ID_DblClick_Error:
| strMsg = "ERROR: " & Err.Description
| If MsgBox(strMsg, vbCritical, "Error:") = vbOK Then
| End If
| Resume fldMachine_ID_DblClick_Exit
| End Sub
| --
| Regards,
|
| Alan
|
|
| "Peter Yang [MSFT]" wrote:
|
| > Hello Alan,
| >
| > Based on my test, the following code works. Thank you.
| >
| > dim rs as object
| > Set rs = Me.Recordset.Clone
| > rs.Find "[id] = " & (Nz(Me![Combo4].Text, 0))
| > If Not rs.EOF Then Me.Bookmark = rs.Bookmark
| >
| > Hope this helps.
| >
| > Best Regards,
| >
| > Peter Yang
| > MCSE2000/2003, MCSA, MCDBA
| > Microsoft Online Partner Support
| >
| > When responding to posts, please "Reply to Group" via your newsreader
so
| > that others may learn and benefit from your issue.
| >
| > =====================================================
| > This posting is provided "AS IS" with no warranties, and confers no
rights.
| >
| > --------------------
| > | Thread-Topic: Referencing GUID
| > | thread-index: AcXI4ODSvsPrDxVwSRqCTGVHw7iOWA==
| > | X-WBNR-Posting-Host: 220.245.178.139
| > | From: "=?Utf-8?B?c3RlZWw=?=" <
[email protected]>
| > | References: <
[email protected]>
| > <
[email protected]>
| > | Subject: RE: Referencing GUID
| > | Date: Tue, 4 Oct 2005 05:41:02 -0700
| > | Lines: 86
| > | Message-ID: <
[email protected]>
| > | MIME-Version: 1.0
| > | Content-Type: text/plain;
| > | charset="Utf-8"
| > | Content-Transfer-Encoding: 7bit
| > | X-Newsreader: Microsoft CDO for Windows 2000
| > | Content-Class: urn:content-classes:message
| > | Importance: normal
| > | Priority: normal
| > | X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.0
| > | Newsgroups: microsoft.public.access.adp.sqlserver
| > | NNTP-Posting-Host: TK2MSFTNGXA03.phx.gbl 10.40.2.250
| > | Path: TK2MSFTNGXA01.phx.gbl!TK2MSFTNGXA03.phx.gbl
| > | Xref: TK2MSFTNGXA01.phx.gbl microsoft.public.access.adp.sqlserver:5747
| > | X-Tomcat-NG: microsoft.public.access.adp.sqlserver
| > |
| > | Peter,
| > |
| > | Thanks for your reply. I have already tried stringfromguid but it
still
| > | didn't work.
| > |
| > | If I use ADODB to find the record I require, do you have a microsoft
site
| > | that explains how I can then locate and display that record on the
Form?
| > Does
| > | GotoRecord produce better reults?
| > |
| > | --
| > | Regards,
| > |
| > | Alan
| > |
| > |
| > | "Peter Yang [MSFT]" wrote:
| > |
| > | > Hello Alan,
| > | >
| > | > You may want to consider use ADODB and search the record directly
by
| > suing
| > | > SQL query. Also, you may use StringFromGUID() to convert the guid
to
| > | > string.
| > | >
| > | > 278099 ACC2000: "????????" Is Displayed as the Value of a SQL
Server
| > GUID
| > | > Field
| > | >
http://support.microsoft.com/?id=278099
| > | >
| > | > Regards,
| > | >
| > | > Peter Yang
| > | > MCSE2000/2003, MCSA, MCDBA
| > | > Microsoft Online Partner Support
| > | >
| > | > When responding to posts, please "Reply to Group" via your
newsreader
| > so
| > | > that others may learn and benefit from your issue.
| > | >
| > | > =====================================================
| > | >
| > | > This posting is provided "AS IS" with no warranties, and confers no
| > rights.
| > | >
| > | > --------------------
| > | > | Thread-Topic: Referencing GUID
| > | > | thread-index: AcXIBfjr9k5oXGowSqSvMvlxjsoXKA==
| > | > | X-WBNR-Posting-Host: 220.245.178.136
| > | > | From: "=?Utf-8?B?c3RlZWw=?=" <
[email protected]>
| > | > | Subject: Referencing GUID
| > | > | Date: Mon, 3 Oct 2005 03:34:02 -0700
| > | > | Lines: 17
| > | > | Message-ID: <
[email protected]>
| > | > | MIME-Version: 1.0
| > | > | Content-Type: text/plain;
| > | > | charset="Utf-8"
| > | > | Content-Transfer-Encoding: 7bit
| > | > | X-Newsreader: Microsoft CDO for Windows 2000
| > | > | Content-Class: urn:content-classes:message
| > | > | Importance: normal
| > | > | Priority: normal
| > | > | X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.0
| > | > | Newsgroups: microsoft.public.access.adp.sqlserver
| > | > | NNTP-Posting-Host: TK2MSFTNGXA03.phx.gbl 10.40.2.250
| > | > | Path: TK2MSFTNGXA01.phx.gbl!TK2MSFTNGXA03.phx.gbl
| > | > | Xref: TK2MSFTNGXA01.phx.gbl
microsoft.public.access.adp.sqlserver:5729
| > | > | X-Tomcat-NG: microsoft.public.access.adp.sqlserver
| > | > |
| > | > | I would like to reference a GUID (uniqueindentifier) to a
variable
| > for
| > | > the
| > | > | code shown below.
| > | > |
| > | > | Dim ctl As Control
| > | > | Set ctl = Forms!frm_Asset_Project!fldMachineVProject_ID_new
| > | > | DoCmd.GoToControl ctl.Name
| > | > | DoCmd.FindRecord Me.fldMachineVProject_ID_old.Value, , True, ,
True
| > | > |
| > | > | - Me.fldMachineVProject_ID_old.Value is the GUID value (this
value
| > reside
| > | > on
| > | > | a sub-form of frm_Asset_Project) I would like to locate on the
main
| > form
| > | > | 'frm_Asset_Project'
| > | > |
| > | > | Thank you.
| > | > | --
| > | > | Regards,
| > | > |
| > | > | Alan
| > | > |
| > | >
| > | >
| > |
| >
| >
|