Need Code To Open TeacherDetailFrm Form Main Form.
Jun 11, 2007
Hi
I need code to open TeacherDetailFrm form Main form.
I have TeacherStudentSubFr*m on the Mainform, FirstNameTxt on the TeacherStudentSubFr*m, and TeacherDetailFrm.
I need code to open the TeacherDetailFrm By double click on the FirstNameTxt.
I use this code but no data come and query dialog box come.
Private Sub FirstNameTxt_DblCli*ck(Cancel As Integer)
Dim DocSubForm As String
Dim DocText As String
DocSubForm = "TeacherDetailFrm"
'DocText = "[Result]=" & "'" & Me![result] & "'"
DoCmd.OpenForm DocSubForm, , , "[ FirstNameFld ]=forms![TeacherStudentSubFrm]![ FirstNameTxt]"
End Sub
I like to upload the file but no way in this forum
View Replies
ADVERTISEMENT
Jun 6, 2013
I have one table containing name of restaurant with its address etc. Then i created another table to list out the restaurant workers names and details. Just as an example,
Table:Restaurant
Restaurant name
Address line 1
Address line 2
Restaurant #
Website
Table:StaffContact
Staff Role
Name
speciality
email
phone
I have the main form that has all the restaurant details only. And i have another form containing the Staff information. Please note the two table have a relation and it works well.
Now to make it user friendly(basically easier for the lazy ones), I dragged the staff contact form on to my main form and displayed it as a datasheet(basically a sub form).
Now, my boss does not want users to add/delete on this sub form(datasheet). So,he wants me to create buttons to open new record of staff for each restaurant(new form)
My issue is with opening a new record to enter a new person to the staff list and give them a role as well in form view.The new form has
So i ran a Macro, with open form with Where condition
Code:
[Staffcontact]![Rest Name]=[Forms]![MainForm]![RestaurantName]
But, it does not work .
View 2 Replies
View Related
Jul 18, 2006
I need to be able to remove the Link Child field and the Link Master field from a subform when I click on a command button on the main form. Is there code that will let me remove these links so that I can add a new record to the subform?
View 1 Replies
View Related
Sep 15, 2015
I want my db to open with only the Main form visible. Nothing else. I don't want the users to be able to see any of the tables or menu options etc.
Can I do this and if so how?
View 3 Replies
View Related
Sep 6, 2014
I have a main form with a combo which lists all forms in my database. There is also a button which open all the forms depending on this which I will choose from my combo.
Private Sub Command2_Click()
DoCmd.OpenForm Me.cmbforms
End Sub
Is there any way to open the forms in a subform in my main form?
View 5 Replies
View Related
Jul 7, 2015
I need to make a query that will show the oldest cases and then open this one in the main form. It will be possible that there could be several cases with the same date. For example the query runs and the results are 7, how could I get one of those cases in the main form.
The idea is that a person will click on a button called "next case", the query will run and then it will open the case in the main form.
How to get this started?
View 7 Replies
View Related
Jun 29, 2015
I have a database that has a main form, and from that main form there are buttons that open their respected forms. I am curious as to how I control the size of all of my forms. They are all pop-ups at the moment. It all works fine on my monitor, but when opened on a smaller monitor it is too big and I can't even see the bottom of the screen. The main form is set to open automatically after the user logs into the database and it opens to fit the screen. also, all of my forms are modals.
View 4 Replies
View Related
May 12, 2014
I have a main form "frmDriverNoticeRecord" with 2 subforms, "frmSubDriverNotice" and "frmSubVehicleRecord"..The main form uses "IncidentID" as the PK. Each form stores data in its own table. The tables are related via IncidentID and there is a 1-many relationship between tblIncident (main) and tblDN (sub) and tblVehicle (sub).
I have a form "frmIncidentLog" displaying records in a table view with a few fields for quick reference and to allow selection of a single record for detailed viewing. I created a command button with the intent to open the "frmDriverNoticeRecord" at the current record. The main form and child link fields appear to be linked correctly; i.e. IncidentID on all three. If I open the form manually it opens and I can use it and search and filter as I want. If I try to open it via the command button It opens a small window asking for the IncidenID, when I enter theIncidentID number, it opens the form to the first record every time.Here is the code:
Private Sub comOpenDR_Click()
Dim frmName As String
Dim recID As String
frmName = "frmDriverNoticeRecord"
recID = "[IncidentID]=" & Me![IncidentID]
DoCmd.OpenForm frmName, , , recID
End Sub
I tried running the the DoCmd.OpenForm command directly from the button using the where condition (in various manners) with the same results.
View 13 Replies
View Related
Jun 24, 2015
I have a database with a Main Menu Form, containing a Button that loads my main data entry form. When the Button is Clicked portions of the data entry form that is loading shows through the Main Form Background (e.g. portions of the navigation bars, and portions of the boarder on the form that is loading.)
View 5 Replies
View Related
Mar 28, 2007
Hello,
My database has two main tables: Table1 and History
Users can add data to this table and decide if store part of data into the History table using an append query behind a cmdbutton. I do this to create an Historical Log of my records.
I then have a main form (form1) with the following code on the OnCurrent event:
If Not IsNull(DLookup("[SSN]", "history", "[SSN] = '" & [SSN] & "'")) Then
msgbox "Record present in the Historical Log!", vbOKOnly, "Warning"
end if
I would now like to change this code so that users are prompt with a message that allows them to either open the form1 or the Historical log (frmHistory)
I would need something like this but cannot get it to work:
If Not IsNull(DLookup("[SSN]", "history", "[SSN] = '" & [SSN] & "'")) Then
msgbox "Record present in the Historical Log!", vbYesNo, "Warning"
If vbYes Then
DoCmd.OpenForm "frmHistory", acNormal, "qryhistoryfrommsgbox", "", , acNormal
If vbNo Then '
'open the regular form1.
Another thing I cannot figure is why this pop up msg comes up even if I close the form. Is there a way to revome it from the close form event?
Thanks.
View 4 Replies
View Related
Jul 24, 2013
I have a report that tracks scores for our employees. From the report, you can click a button to add a new score in a form or edit an existing score(frmscoretracker). On this form there are two subforms, in a tabbed control to track additional information about the score; what areas were marked down(Trends), and was it a failing score(AutoFail).
When this form opens I have it programmed to only show the subform if there is data in it. The goal being, if I am adding a new score and there is no existing trends or Autofails for this new record, neither subforms will show - I will add an after update even to show either trends or autofail depending on the score recorded. Also, if someone chooses to edit the score, whatever subform with data, will show as well.
When someone clicks to add a new score, opening this main form to a new record, both of the tabs show. However, if the form opens to an existing record, the appropriate tab shows. Here is the code
Code:
Private Sub Form_Open(Cancel As Integer)
'If the subform has a record, the tab is visible, if not, the tab is not visible
If Me.frmtrends.Form.Recordset.RecordCount > 0 Or IsNull(Me.Trends) Then
Me.Trends.Visible = True
Me.TabCtl33.Visible = True
Else
Me.Trends.Visible = False
End If
[code]...
Both tabs are set as not visible in the default settings. Is there something in this code that is triggering then to be visible when there is no record in the main form?
View 4 Replies
View Related
Dec 1, 2005
I have a subform which makes a change to a field on the main form. When focus is returned to the main form, the BeforeUpdate and AfterUpdate events fire. Why? I thought from the form's perspective, the subform is just another control.
BTW, I get the same behavior if I modify the field from within the Exit event of the subform control.
In either case, the main form's Dirty event is NOT triggered.
View 2 Replies
View Related
Aug 29, 2005
Hi
I need a button code in the OnClick event.
I want when clicking on the button, to close the currently opened form and open another one.
Any help will be very much appreciated!
Thanks guys!
C.
View 10 Replies
View Related
Oct 9, 2006
I have a database with lists clients across the UK. I have now been asked to provide options where users can select clients grouped by geopraphical area e.g say clients in Scotland.
I can of course do this but having numerous identical forms where the source queries have different parameters depending on the regions required.
The only problem with this is that I would need numerous forms and queries. Additionally, there are options on the form to navigate to linked forms which would all need to be unique.
What I would like to have options on my main (Switchboard Type) Introduction Form to select the region. The code on the relevent command button would include the parameter. I would therefore not require the additional forms.
The open form codes includes:
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "frmClients"
DoCmd.OpenForm stDocName, , , stLinkCriteria
I feel i need something after "frmClients" such as qryClients.ClientArea = "Not Scotland". Various attempts to incorporate something has created errors.
Any quidance on code would be appreciated.
Thank you...Paul
View 3 Replies
View Related
Dec 14, 2006
Hello..
I have the following code that I have been trying to get to work:
Private Sub txtSocNumber_DblClick(Cancel As Integer)
On Error GoTo Err_txtSocNumber_DblClick
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "FrmApplicantFullDetails"
If IsNull(Me.txtSocNumber) Or Me.txtSocNumber = "" Then
MsgBox "This record is empty", vbInformation, "No Data"
Me.txtSocNumber.SetFocus
Else
stLinkCriteria = "[ApplicantID]=" & Me![InvestigatorID]
DoCmd.OpenForm stDocName, , , stLinkCriteria
End If
Exit_txtSocNumber_DblClick:
Exit Sub
Err_txtSocNumber_DblClick:
MsgBox Err.Description
Resume Exit_txtSocNumber_DblClick
End Sub
I have the following two tables:
Applicant and Investigator
Applicant:
ApplicantID
InvestigatorID
etc
Investigator:
InvestigatorID
etc
The relationship is setup as 1 investigator to many applicants.
What I am trying do is this. I have form with a subform in it. In the subform there is applicant info IE SS# LName, FName and that is it. What I want to do is be able to double click on the SS# have the form "FrmApplicantFullDetails" open so you can view the work up on the applicant or edit info on the applicant.
Am I going about this the right way with the above code? Or is there something else I am missing in the code or is there code out that will do what I am looking for that is easier?
Thanks
R~
View 5 Replies
View Related
Dec 19, 2014
In the initial Form_Open code there is a string that fails before the form is open, preventing me from opening the form and accessing the VBA code to correct the problem.How can I access the VBA code to correct the problem if it otherwise prevents me from opening the form so I can access the VBA code?
View 7 Replies
View Related
Sep 4, 2014
I am using a datasheet view with dbl click code to open a form to a selected record. I was able to use pbaldy's code and it worked perfectly.
DoCmd.OpenForm "Asset Status", , , "[Project Number] = '" & Me.Project_Number & " ' "
Then I realized I really want to be able to go to other records after I have gone to this form and tried this:
Dim rs As Object
Dim lngBookmark As Long
'set variable to the current record
lngBookmark = Me.Project_Number
'open new form
[code]....
But to no avail. Project_Number is a text field.
View 12 Replies
View Related
Oct 13, 2015
I am at my Login Screen, I want it to return to the Login Screen if you select "NO" and Close the DB if "YES"
Here is my current code:
Private Sub Form_Close()
If MsgBox("Would you like to EXIT the Database?", vbYesNo, "Quiting Database") = vbYes Then
Application.Quit
Else
???
End If
End Sub
View 5 Replies
View Related
Dec 16, 2014
I am creating an events database. In my main form, I have all the details of a single event (billing code, fees, customer, support personnel, etc.). Then, I have a subform (form view) that lists each of the other services which share an event ID (this ID comes from a separate, unrelated events management suite). In the subform, I display the most-commonly-edited fields so that they are editable without navigating to a different record.
However, there will be instances where it becomes necessary to navigate to one of the records listed in the subform. I would like to make this a quick process by just clicking on the primary key in the subform, and have the corresponding record appear in the main form.
In my searches I've found a common suggestion to use a DoCmd.OpenForm method where the form opens to that specific record -- in effect filtering by the primary key number. I don't prefer this method because it disables the ability to navigate to other records using the previous, next, find records, (etc.) buttons without closing and re-opening the form.
Is there a way to make the main form 'jump' to a specific record by clicking on a control in the subform, without limiting the ability to navigate in the main form?
View 10 Replies
View Related
Aug 27, 2014
On the form: User enters first name, then last name. Upon updating the last name field, I would like another form to pop-up and display all the people with that same first name and last name that the user just entered.
On the pop-up form: All of the matching first names/last names are listed with a button control beside each record that says 'Select'. The user clicks the select button beside the record he/she wants. This pop-up form closes and all of the data from this selected record is now showing on the original form.
So far, I have a query/form that pops up only showing the matching first/last names. I'm having a hard time getting my original form to auto-populate with that record that the user selects on the pop-up.
(Also my main form is actually a sub-sub form - so in my trials I could've been massacring my syntax trying to point to it.)
View 5 Replies
View Related
Mar 26, 2013
Basically I have a Customer Form, which I have a New party button on it,this button opens up the party form to a new party, what I would like it to do is open up a new party but make the new party for the customer I had selected in the previous form.I have tried the GoTo macro's but cannot seem to get it to work.
I am thinking on clicking the button it will need to get the Customer ID, and then open the party form, create new party, and paste in the Customer ID, which then updates the Name - Date - Address - Company Fields.
View 5 Replies
View Related
Jul 24, 2013
I have a form, which is comprised of a sub form, and some of the text box controls sided with a button, and the event had been written to the button.
Now, to give a note on how had the sub form had been created is firstly taking a clone of the "Payments" table and using it as a datasheet, and then create a sub form in the form, it works fine
View 2 Replies
View Related
Nov 28, 2013
I have a main form (tsTimeSheetMain) which contains a sub form (tsTimeSheetDataNewSub) in data sheet view. When I click off one row onto another row in the sub form, it triggers this code:
Forms!tsTimeSheetMain!ProjectMonSum.Requery
i.e. it tries to requery the ProjectMonSum field (on the main form) which is a dsum calculated field. This works fine and updates the ProjectMonSum field (which dsums values from the same datasource as the subform.
However, this seems to put the cursor back to the top left field in the subform (datasheet view), rather than leave it in the field I click on (in the subform).
Why is this happening and what is a decent workaround this issue? I just want to update the calculated dsum field each time you update values in the subform.
View 8 Replies
View Related
Apr 11, 2005
I have one main form with 3 tabulated sub forms.
My main form consists of two fields.
When the user clicks tab 2 (subform 2) or tab 3 (subform 3) the main fields should hide
I tried to achieve this by using the on click event at the tabbed forms. I referenced the two main fields and used the visible property followed by a form requery. It didn't work.
thanks in advance
View 1 Replies
View Related
Aug 25, 2005
Hi all,
I've added a message box to what is basically a standard simple to use access control, "closeForm", I'm a newbie working on learning access vb. I'm guessing my code if fudged. Any help is greatly appreciated.
Private Sub Close_Click()
On Error GoTo Err_Close_Click
Dim Answer As Integer
Answer = MsgBox("Press Ok to Close, Cancel to Continue.", vbOKCancel + vbQuestion, "Exit Data Entry?")
If vbOK Then DoCmd.Close
Exit_Close_Click:
Exit Sub
Err_Close_Click:
MsgBox Err.Description
Resume Exit_Close_Click
End Sub
Thanks to all in advance
View 5 Replies
View Related
Sep 2, 2006
I'm not sure how to search on this, even in the advanced search. If this has been answered, could you point me in the right direction?
I have a main form AddNewCompany (the infamous tab control that now works - thanks to your combined efforts). On it I have a command button that pops up a form of continuous forms with all the companies in the table (the query calls the CompanyID and CompanyName fields only). I have attached an image of the interface.
This means the user can see if the company already exists and doesn't enter it again. (I'm sure there are more effecient ways of doing this, but this is simple and it works. I also know key fields should be autonumbers instead of text, but I have reasons for doing it this way).
What I would like to be able to do is click on the CompanyID field and have the companies information show up in the main form.
View 14 Replies
View Related