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. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
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
|
|||
|
|||
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 | |
|
|