I have 2 forms that I'm trying to synchronize. I have an Access form
called "Login". "Command10" is a button on the form and "Text5" is a
text field on it. When a user enters a numeric value (InstructorID) in
the Text5 text field and clicks the button Command10, it opens another
form called "Existing Instructor", displaying the InstructorID and all
the relevant information on the new form.
Here's the catch. Let's say there are 2 Instructors in the table, Joe
and Sam with InstructorID 60 and 70 respectively. When I enter 60 in
Text5 on the Login Form and click the button, it takes me to the
Existing Instructor Form showing all the information for that
instructor, namely Joe. But when I enter 70 (or any other existing
value) in the Login Form and click the button, it still takes me to the
Existing Instructor Form but it shows all the information for the first
record(InstructorID = 60, InstructorLastName = Joe). How do I
synchronize the forms so that when a certain InstructorID is entered on
the Login form, the corresponding InstructorID and other information
for that record are displayed on the Existing Instructor Form? Any help
would be greatly appreciated.
Thanks
Shal 3 5860
Shaldaman wrote: I have 2 forms that I'm trying to synchronize. I have an Access form called "Login". "Command10" is a button on the form and "Text5" is a text field on it. When a user enters a numeric value (InstructorID) in the Text5 text field and clicks the button Command10, it opens another form called "Existing Instructor", displaying the InstructorID and all the relevant information on the new form.
Here's the catch. Let's say there are 2 Instructors in the table, Joe and Sam with InstructorID 60 and 70 respectively. When I enter 60 in Text5 on the Login Form and click the button, it takes me to the Existing Instructor Form showing all the information for that instructor, namely Joe. But when I enter 70 (or any other existing value) in the Login Form and click the button, it still takes me to the Existing Instructor Form but it shows all the information for the first record(InstructorID = 60, InstructorLastName = Joe). How do I synchronize the forms so that when a certain InstructorID is entered on the Login form, the corresponding InstructorID and other information for that record are displayed on the Existing Instructor Form? Any help would be greatly appreciated.
Thanks Shal
The button needs to apply a filter to the form it is opening. One of the wizard
options when adding a new command button does exaclty what you are looking for.
--
I don't check the Email account attached
to this message. Send instead to...
RBrandt at Hunter dot com
Here's something I tried. This is my OnClick procedure associated with
the button Command10 on the form Login:
Private Sub Command10_Click()
On Error GoTo Err_Command10_Click
Dim stDocName As String
Dim stLinkCriteria As String
'Dimension variables.
Dim formname As String, SyncCriteria As String
Dim frm As Form, rs As DAO.Recordset
stDocName = "Existing Instructor"
'Set the formname to "Login," the form that will be synchronized.
formname = "Login"
'Define the form object and Recordset object for the Login form.
Set frm = Forms(formname)
Set rs = frm.RecordsetClone
'Define the criteria used for the synchronization.
SyncCriteria = BuildCriteria("InstructorID", dbLong,
Forms![Existing Instructor]!InstructorID)
'Validation to see if Instructor Last Name and InstructorID match
If DCount("*", "Instructor", "[InstructorID] = " & Me!Text5 & "
And [InstructLastName] = '" & Me!Text7 & "'") > 0 Then
DoCmd.OpenForm stDocName, , , stLinkCriteria
'Synchronize the corresponding record in the Login form to the
current record in the subform.
rs.FindFirst SyncCriteria
Else
MsgBox "Instructor ID and Last Name do not match. Please try
again"
End If
Exit_Command10_Click:
Exit Sub
Err_Command10_Click:
MsgBox Err.Description
Resume Exit_Command10_Click
End Sub
But I'm getting an error message "Microsoft Office Access can't find
the form 'Existing Instructor' referred to in a macro expression or
Visual Basic code" . I feel like I might be on the right track but
something's amiss...
"Shaldaman" <sh************@gmail.com> wrote in message
news:11**********************@g14g2000cwa.googlegr oups.com... Here's something I tried. This is my OnClick procedure associated with the button Command10 on the form Login:
Private Sub Command10_Click() On Error GoTo Err_Command10_Click
Dim stDocName As String Dim stLinkCriteria As String
'Dimension variables. Dim formname As String, SyncCriteria As String Dim frm As Form, rs As DAO.Recordset
stDocName = "Existing Instructor"
'Set the formname to "Login," the form that will be synchronized. formname = "Login"
'Define the form object and Recordset object for the Login form. Set frm = Forms(formname) Set rs = frm.RecordsetClone
'Define the criteria used for the synchronization. SyncCriteria = BuildCriteria("InstructorID", dbLong, Forms![Existing Instructor]!InstructorID)
'Validation to see if Instructor Last Name and InstructorID match If DCount("*", "Instructor", "[InstructorID] = " & Me!Text5 & " And [InstructLastName] = '" & Me!Text7 & "'") > 0 Then DoCmd.OpenForm stDocName, , , stLinkCriteria
'Synchronize the corresponding record in the Login form to the current record in the subform. rs.FindFirst SyncCriteria
Else MsgBox "Instructor ID and Last Name do not match. Please try again" End If
Exit_Command10_Click: Exit Sub
Err_Command10_Click: MsgBox Err.Description Resume Exit_Command10_Click End Sub
But I'm getting an error message "Microsoft Office Access can't find the form 'Existing Instructor' referred to in a macro expression or Visual Basic code" . I feel like I might be on the right track but something's amiss...
I think you're trying too hard here. This requires only one of line of code.
You're setting the variable for the name of the form to "Existing Instructor",
but then you also have a form name variable with the value "Login". What is the
name of the form you want to open? That needs to be the first argument for the
OpenForm method.
--
I don't check the Email account attached
to this message. Send instead to...
RBrandt at Hunter dot com This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Keith Veleba |
last post by:
Hello to all fellow c.l.p'ers!
Long-time listener, first-time caller.
Background:
I'm working on a project where I have to do some serious
multithreading. I've worked up a decorator in Python...
|
by: Tom |
last post by:
The purpose of my form is to record multiple owners of businesses. The main form
displays the business records. Subform1 is a continuous form consisting of only
a combobox to select owners from a...
|
by: Jeff Smith |
last post by:
Hi
This is a repost due to no responses
Here's a problem I've encountered with Access 2003 which has got me to
redesign how I get the row source in a second combo box using the first
combo...
|
by: John Phelan-Cummings |
last post by:
What Works
I have a subform (Events1) with a combo box field called “eventname”.
The combo box displays the correct information from the second column of
its lookup table, i.e., column #1:...
|
by: Bamse |
last post by:
Hi, I want to synchronize (the Master-Details concept) 2 grids in 2
different forms by using BindingContext.
is this possible?
|
by: Christopher D. Wiederspan |
last post by:
We are getting ready to move an ASP.NET application off of a single
development machine and onto a "webfarm". Basically our webfarm is a bunch
of identical servers with the load-balancing provided...
|
by: Chris Ochs |
last post by:
We have a number of tables in a CRM that is written in MS access that I need
to be able to provide a web interface to. I can export the tables just fine
using pgadmin II, but I cant' think of a...
|
by: MaxMax |
last post by:
I'm using HttpWebRequest. It seems that all the callback called from
HttpWebRequest are in another thread (not in the "original" thread). Now my
problem is that the "original" thread is the thread...
|
by: eskelies |
last post by:
Hello all,
I have two forms, which are already synchronized, however, everytime I page to the next set of data both queries run again. This slows down my database to a point of unreponsiveness. Is...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: ArrayDB |
last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
|
by: PapaRatzi |
last post by:
Hello,
I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
|
by: CloudSolutions |
last post by:
Introduction:
For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
|
by: Defcon1945 |
last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
|
by: Shællîpôpï 09 |
last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
|
by: af34tf |
last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome former...
| |