DoCmd.OpenForm Problem
- From: Mike <me@xxxxxxx>
- Date: Sun, 30 Oct 2005 04:10:16 GMT
I am trying to open a search results form based on the input from a
prompt form. I am using the following code:
--- Begin Code ---
Private Sub btnSearch_Click()
'Dim Variable and assign data
Dim srce As String, fstnme As String, lstnme As String, bidnum As String
srce = Me.Source_Control
If Not IsNull(Me.Text18) Then
lstnme = Me.Text18
'Open Results Form
DoCmd.OpenForm "frmSearch_Results", , , "[last_name] = '" & lstnme & "'"
'Assign Source Control Data
Forms![frmSearch_Results].[Source_Control] = srce
'Close Search Form
DoCmd.Close acForm, "frmCustomer_Search", acSaveNo
Exit Sub
ElseIf Not IsNull(Me.Text16) Then
fstnme = Me.Text16
'Open Results Form
DoCmd.OpenForm "frmSearch_Results", , , "[first_name] = '" & fstnme &"'"
'Assign Source Control Data
Forms![frmSearch_Results].[Source_Control] = srce
'Close Search Form
DoCmd.Close acForm, "frmCustomer_Search", acSaveNo
Exit Sub
ElseIf Not IsNull(Me.Text20) Then
bidnum = Me.Text20
'Open Results Form
DoCmd.OpenForm "frmSearch_Results", , , "[last_bidder_number] = " &
bidnum 'Assign Source Control Data
Forms![frmSearch_Results].[Source_Control] = srce
'Close Search Form
DoCmd.Close acForm, "frmCustomer_Search", acSaveNo
Exit Sub
End If
End Sub
--- End Code ---
Sorry for the word wrapping. All the lines are single lines no wraping
in the program.
The primary search field is the last name. This is why it is checked
first. The problem is when I open the search results form, it opens with
the previous query results not the current request, unless I set a break
point and the code pauses and I then hit the 'RUN' key (F5) to contine
the code execution.
How can I get the form to open with the correct results without stopping
or pausing the code run?
I am using MS-Access 2003 as a front end to a MS-SQL MSDE backend. This
is an Access Project.
Thansk for any help!!
Mike Charney
.
- Follow-Ups:
- Re: DoCmd.OpenForm Problem
- From: cjb_kjb
- Re: DoCmd.OpenForm Problem
- From: MacDermott
- Re: DoCmd.OpenForm Problem
- Prev by Date: Re: Looping variables - Integer vs Long
- Next by Date: Reference If Statement Result
- Previous by thread: Re: If Statement Unbound Text Box
- Next by thread: Re: DoCmd.OpenForm Problem
- Index(es):
Relevant Pages
|