-
Autosearch between two windows?
Is it possilbe to create an autosearch feature between two windows either in Access or VB?
I have have a Lookup Window and an Add New Window. I would like to have the Lookup box automaticly show the just added data from the Add New Window.
Here is the VB Code for my Add New Window (I did not create this):
Code:
Option Compare Database
Private Sub Btn_Save_Close_Click()
On Error GoTo Err_Btn_Save_Close_Click
DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
DoCmd.Close
Exit_Btn_Save_Close_Click:
Exit Sub
Err_Btn_Save_Close_Click:
MsgBox Err.Description
Resume Exit_Btn_Save_Close_Click
End Sub
Private Sub Btn_Undo_Click()
On Error GoTo Err_Btn_Undo_Click
DoCmd.DoMenuItem acFormBar, acEditMenu, acUndo, , acMenuVer70
DoCmd.Close
Exit_Btn_Undo_Click:
Exit Sub
Err_Btn_Undo_Click:
MsgBox Err.Description
Resume Exit_Btn_Undo_Click
End Sub
Here is the VB Code for my Lookup Window:
Code:
Private Sub Ck_NoShow_Click()
On Error GoTo Err_Ck_NoShow_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "Frm_NoShow"
stLinkCriteria = "[SSN]=" & "'" & Me![SSN] & "'"
DoCmd.OpenForm stDocName, , , stLinkCriteria
Exit_Ck_NoShow_Click:
Exit Sub
Err_Ck_NoShow_Click:
MsgBox Err.Description
Resume Exit_Ck_NoShow_Click
End Sub
Private Sub LUFIRST_Click()
On Error GoTo Err_LUFIRST_Click
Dim Message, Title, Default, First
Screen.PreviousControl.SetFocus
DoCmd.RunCommand acCmdSortAscending
Message = "Enter a Student's First Name" ' Set prompt.
Title = "First Name Lookup" ' Set title.
Default = "First Name" ' Set default.
' Display message, title, and default value.
First = InputBox(Message, Title, Default)
'SSN = inputbox ('Enter Student Number',[Enter SSN],,,,,) as String
DoCmd.FindRecord First, acAnywhere, False, , False, acCurrent, True
Exit_LUFIRST_Click:
Exit Sub
Err_LUFIRST_Click:
MsgBox Err.Description
Resume Exit_LUFIRST_Click
End Sub
Private Sub LULAST_Click()
On Error GoTo Err_LULAST_Click
Dim Message, Title, Default, Last
Screen.PreviousControl.SetFocus
DoCmd.RunCommand acCmdSortAscending
Message = "Enter a Student's Last Name" ' Set prompt.
Title = "Last Name Lookup" ' Set title.
Default = "Last Name" ' Set default.
' Display message, title, and default value.
Last = InputBox(Message, Title, Default)
'SSN = inputbox ('Enter Student Number',[Enter SSN],,,,,) as String
DoCmd.FindRecord Last, acAnywhere, False, , False, acCurrent, True
'DoCmd.DoMenuItem acFormBar, acEditMenu, 10, , acMenuVer70
Exit_LULAST_Click:
Exit Sub
Err_LULAST_Click:
MsgBox Err.Description
Resume Exit_LULAST_Click
End Sub
Private Sub LUSSN1_Click()
On Error GoTo Err_LUSSN1_Click
Dim Message, Title, Default, SSN
Screen.PreviousControl.SetFocus
DoCmd.RunCommand acCmdSortAscending
Message = "Enter a Student's SSN" ' Set prompt.
Title = "SSN Lookup" ' Set title.
Default = "SSN" ' Set default.
' Display message, title, and default value.
SSN = InputBox(Message, Title, Default)
'SSN = inputbox ('Enter Student Number',[Enter SSN],,,,,) as String
DoCmd.FindRecord SSN, acAnywhere, False, , False, acCurrent, True
'DoCmd.DoMenuItem acFormBar, acEditMenu, 10, , acMenuVer70
Exit_LUSSN1_Click:
Exit Sub
Err_LUSSN1_Click:
MsgBox Err.Description
Resume Exit_LUSSN1_Click
End Sub
Private Sub Open_Training_Record_Click()
On Error GoTo Err_Open_Training_Record_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "Frm_SubTrainingInfo"
stLinkCriteria = "[SSN]=" & "'" & Me![SSN] & "'"
DoCmd.OpenForm stDocName, , , stLinkCriteria
Exit_Open_Training_Record_Click:
Exit Sub
Err_Open_Training_Record_Click:
MsgBox Err.Description
Resume Exit_Open_Training_Record_Click
End Sub
Private Sub Btn_Open_Coach_Click()
On Error GoTo Err_Btn_Open_Coach_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "Frm_SubCoachingInfo"
stLinkCriteria = "[SSN]=" & "'" & Me![SSN] & "'"
DoCmd.OpenForm stDocName, , , stLinkCriteria
Exit_Btn_Open_Coach_Click:
Exit Sub
Err_Btn_Open_Coach_Click:
MsgBox Err.Description
Resume Exit_Btn_Open_Coach_Click
End Sub
Private Sub Btn_TAISData_Click()
On Error GoTo Err_Btn_TAISData_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "Frm_TAISData"
stLinkCriteria = "[SSN]=" & "'" & Me![SSN] & "'"
DoCmd.OpenForm stDocName, , , stLinkCriteria
Exit_Btn_TAISData_Click:
Exit Sub
Err_Btn_TAISData_Click:
MsgBox Err.Description
Resume Exit_Btn_TAISData_Click
End Sub
Private Sub Command26_Click()
On Error GoTo Err_Command26_Click
Screen.PreviousControl.SetFocus
DoCmd.FindNext
Exit_Command26_Click:
Exit Sub
Err_Command26_Click:
MsgBox Err.Description
Resume Exit_Command26_Click
End Sub
Private Sub Btn_Request_Followup_Click()
On Error GoTo Err_Btn_Request_Followup_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "Frm_FollowupReq"
stLinkCriteria = "[SSN]=" & "'" & Me![SSN] & "'"
DoCmd.OpenForm stDocName, , , stLinkCriteria
Exit_Btn_Request_Followup_Click:
Exit Sub
Err_Btn_Request_Followup_Click:
MsgBox Err.Description
Resume Exit_Btn_Request_Followup_Click
End Sub
Private Sub FindNext_Click()
On Error GoTo Err_FindNext_Click
Dim Msg, Style, Title, Help, Ctxt, Response, MyString
Screen.PreviousControl.SetFocus
DoCmd.FindNext
Exit_FindNext_Click:
Exit Sub
Err_FindNext_Click:
Msg = "You must first select the box you wish to lookup then click the Lookup button next to it! You may only use the Find Next button after you enter a lookup value for the Names, Not The SSN!" ' Define message.
Style = vbOKOnly 'vbCritical + vbDefaultButton2 ' Define buttons.
Title = "Find Next Error" ' Define title.
Help = "Demo.hlp"
Ctxt = 1000 ' Define topic
Response = MsgBox(Msg, Style, Title, Help, Ctxt)
'MsgBox Err.Description
Resume Exit_FindNext_Click
End Sub
Private Sub Btn_Ent_Student_Click()
On Error GoTo Err_Btn_Ent_Student_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "Frm_NewRec"
DoCmd.OpenForm stDocName, , , stLinkCriteria
Exit_Btn_Ent_Student_Click:
Exit Sub
Err_Btn_Ent_Student_Click:
MsgBox Err.Description
Resume Exit_Btn_Ent_Student_Click
End Sub
Private Sub Ck_NoShow2_Click()
On Error GoTo Err_Ck_NoShow2_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "Frm_NoShow"
stLinkCriteria = "[SSN]=" & "'" & Me![SSN] & "'"
DoCmd.OpenForm stDocName, , , stLinkCriteria
Exit_Ck_NoShow2_Click:
Exit Sub
Err_Ck_NoShow2_Click:
MsgBox Err.Description
Resume Exit_Ck_NoShow2_Click
End Sub
Private Sub Save_Exit_Database_Click()
On Error GoTo Err_Save_Exit_Database_Click
DoCmd.Quit
Exit_Save_Exit_Database_Click:
Exit Sub
Err_Save_Exit_Database_Click:
MsgBox Err.Description
Resume Exit_Save_Exit_Database_Click
End Sub
Private Sub Find_Previous_Click()
On Error GoTo Err_Find_Previous_Click
DoCmd.GoToRecord , , acPrevious
Exit_Find_Previous_Click:
Exit Sub
Err_Find_Previous_Click:
MsgBox Err.Description
Resume Exit_Find_Previous_Click
End Sub
Private Sub FindPrevious_Click()
On Error GoTo Err_FindPrevious_Click
DoCmd.GoToRecord , , acPrevious
Exit_FindPrevious_Click:
Exit Sub
Err_FindPrevious_Click:
MsgBox Err.Description
Resume Exit_FindPrevious_Click
End Sub
Private Sub FindNextRecord_Click()
On Error GoTo Err_FindNextRecord_Click
DoCmd.GoToRecord , , acNext
Exit_FindNextRecord_Click:
Exit Sub
Err_FindNextRecord_Click:
MsgBox Err.Description
Resume Exit_FindNextRecord_Click
End Sub
I want to create a container that inputs the SSN in the Add New so I can do the autosearch in the Database and have the person come up automaticly in the Look up Window. Right now everytime we input data, we close the Add new window and have to do a search for the data we just input into the Add New window.
Thank you in advance
Similar Threads
-
By Carcophan in forum C++
Replies: 2
Last Post: 11-28-2005, 10:26 PM
-
By Gwen Smith in forum vb.announcements
Replies: 0
Last Post: 04-28-2003, 02:37 PM
-
By pwilmarth in forum .NET
Replies: 2
Last Post: 11-25-2002, 02:54 PM
-
By Dennis in forum VB Classic
Replies: 10
Last Post: 02-15-2001, 03:52 AM
-
By Toni Bisson in forum VB Classic
Replies: 0
Last Post: 01-19-2001, 12:54 PM
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Development Centers
-- Android Development Center
-- Cloud Development Project Center
-- HTML5 Development Center
-- Windows Mobile Development Center
|