No Record Display after Click

N

Nora

In my form, "Form1" (which link to a query), there are 2 command buttons. 1
is to run the query and the other is to return to switchboard. When the query
runs, it open another form, "Form2" (which display the filtered record which
I entered in Form1), has 1 command button which closes Form2 (the active
form) and return to Form1 for another new query.

My problem now is whenever I'm back in Form1 to enter another new query, the
result in Form2 is blank. Why is this? How could I overcome this issue? Here
are the codes:-

Form1’s (“Find Tenderâ€)

Query Parameters
Name Type
Forms![Find Tender]!Code Text
Forms![Find Tender]!Part Text
Forms![Find Tender]![GQ No] Text

Code

1 VERSION 1.0 CLASS
2 BEGIN
3 MultiUse = -1 'True
4 END
5 Attribute VB_Name = "Form_Find Tender"
6 Attribute VB_GlobalNameSpace = False
7 Attribute VB_Creatable = True
8 Attribute VB_PredeclaredId = True
9 Attribute VB_Exposed = False
10 Option Compare Database
11 Option Explicit
12
13 Private Sub Command4_Click()
14 On Error GoTo Err_Command4_Click
15
16 Dim stDocName As String
17 Dim stLinkCriteria As String
18 Dim stLinkCriteria2 As String
19
20 stDocName = "Tender Record"
21
22 If IsNull([Part]) = True Then
23 stLinkCriteria = "
Code:
=" & "'" & Me![Code] & "'And[Reg No]="
& "'" & Me![GQ No] & "'"
24	        DoCmd.OpenForm stDocName, , , stLinkCriteria
25	    Else
26	        stLinkCriteria2 = "[Code]=" & "'" & Me![Code] & "'And[Reg No]="
& "'" & Me![GQ No] &
"'And[Part]=" & "'" & Me![Part] & "'"
27	        DoCmd.OpenForm stDocName, , , stLinkCriteria2
28	    End If
29
30	Exit_Command4_Click:
31	    Exit Sub
32
33	Err_Command4_Click:
34	    MsgBox Err.Description
35	    Resume Exit_Command4_Click
36
37	End Sub


Form2’s (Tender Record)

On Click - Macro: Close And Open (Original)

Actions
Name	Condition	Action	Argument	Value
Close                 	Object Type: 	Form

Object Name: 	Tender Record
Save: 	Prompt

OpenForm         	Form Name: 	Find Tender
View: 	Form

Filter Name:

Where Condition:

Data Mode: 	-1

Window Mode: 	Normal

SetValue            	Item: 	[Forms]![Find Tender]![Code]
Expression: 		“â€

SetValue            	Item: 	[Forms]![Find Tender]![GQ No]
Expression: 		“â€

SetValue            	Item: 	[Forms]![Find Tender]![Part]
Expression: 		“â€

GoToControl      	Control Name: 	Code

Thank you for your assistance.

Regards,
Nora
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

stLinkCriteria 2
How to create code 2
Data Entry = No 6
display a field from another form 2
setvalue macro 4
Form not linking when adding a new record 2
popup issue if no existing record 1
DoCMD maximize 3

Top