A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Need an expert



 
 
Thread Tools Display Modes
  #1  
Old December 30th, 2006, 11:30 PM posted to microsoft.public.access.forms
Steve W
external usenet poster
 
Posts: 1
Default Need an expert

Maybe not.... Just someone that has a brain larger then the match head I
have. ORDERID is the field I have changed.

Here's the problem. A filter problem. The code i have been using not sure
where I got it from, Definitely not from myself but I have been using it to
open a form that is nothing more the a list box, then by clicking on a
record in the list box it would open up an other form which was based on the
primary key. The primary key in the table was set up as a Number field /
long integer and it worked great. Now I have done some modifying to my
tables and need to make the primary key a text field, when make it a text
field it n the code no longer works..Can you help me?


Here is the code that I have used when the primary key was an integer:



Private Sub List0_DblClick(Cancel As Integer)

Dim FrmName As String



'use the form name that you want to go to

FrmName = "frmCustomerOrder"





If IsNull(Me!List0.Column(2)) Then Exit Sub



On Error Resume Next



DoCmd.OpenForm FrmName

With Forms(FrmName)

.Filter = ""

'use the field name that is the ID field (the primary key)



..RecordsetClone.FindFirst "[OrderID]=" & Me!List0.Column(2) 'This is the
problem

.Bookmark = .RecordsetClone.Bookmark

DoCmd.Close acForm, "frmJobsNotApproved"

End With





If Err = 0 Then Exit Sub



If Err 0 Then MsgBox Error & vbCrLf & vbCrLf & "Examine the field
name and the criteria after FindFirst in the code. That part of the code may
need modification."



End Sub



Thank you, Thank you, Thank you



Steve


  #2  
Old December 30th, 2006, 11:56 PM posted to microsoft.public.access.forms
Arvin Meyer [MVP]
external usenet poster
 
Posts: 4,231
Default Need an expert

Instead of:

..RecordsetClone.FindFirst "[OrderID]=" & Me!List0.Column(2)

use:

.RecordsetClone.FindFirst "[OrderID] = '" & Me!List0.Column(2) & "'"
--
Arvin Meyer, MCP, MVP
http://www.datastrat.com
http://www.mvps.org/access
http://www.accessmvp.com

"Steve W" wrote in message
...
Maybe not.... Just someone that has a brain larger then the match head I
have. ORDERID is the field I have changed.

Here's the problem. A filter problem. The code i have been using not
sure where I got it from, Definitely not from myself but I have been using
it to open a form that is nothing more the a list box, then by clicking on
a record in the list box it would open up an other form which was based on
the primary key. The primary key in the table was set up as a Number
field / long integer and it worked great. Now I have done some modifying
to my tables and need to make the primary key a text field, when make it a
text field it n the code no longer works..Can you help me?


Here is the code that I have used when the primary key was an integer:



Private Sub List0_DblClick(Cancel As Integer)

Dim FrmName As String



'use the form name that you want to go to

FrmName = "frmCustomerOrder"





If IsNull(Me!List0.Column(2)) Then Exit Sub



On Error Resume Next



DoCmd.OpenForm FrmName

With Forms(FrmName)

.Filter = ""

'use the field name that is the ID field (the primary key)



.RecordsetClone.FindFirst "[OrderID]=" & Me!List0.Column(2) 'This is the
problem

.Bookmark = .RecordsetClone.Bookmark

DoCmd.Close acForm, "frmJobsNotApproved"

End With





If Err = 0 Then Exit Sub



If Err 0 Then MsgBox Error & vbCrLf & vbCrLf & "Examine the field
name and the criteria after FindFirst in the code. That part of the code
may need modification."



End Sub



Thank you, Thank you, Thank you



Steve




 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 10:57 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.