I'm trying to open a form based on another form and have the following code in the Open Event:
Private Sub Form_Open(Cancel As Integer)
On Error GoTo Err_FormOpen
Dim strForm As String
strForm = "frmProductionBatch"
If IsLoaded(strForm) Then
Me.ProductName = Forms![frmProductionBatch]![ProductName]
Me.BatchNum = Forms![frmProductionBatch]![BatchNum]
Else
End If
Exit_FormOpen:
Exit Sub
Err_FormOpen:
MsgBox Err.Description
Resume Exit_FormOpen
End Sub
It works however I get an error message stating that I cannot assign a value to this Object?
What is going on here?
I've taken a break from Access for a while, but I'm back at it again and having some difficulty. I am trying to open a form with a timer to state that the database is going to shut down in five minutes if they don't respond. I'm obviously using the wrong code. I've been trying to use the following:
Private Sub Form_Timer() DoCmd.OpenForm "frmWarning" If Forms!frmHidden!chkActive Then Forms!frmHidden!chkActive = False Me.TimerInterval = 300000 Else DoCmd.Quit End If End Sub
I have code for a button click event. Essentially I have a main table form that I use to enter customer data and info. I also have a button that I use to add that customer to a separate table that I use for special Customers. My code copies all the data I need copied to my other table, so I wont waste space here typing my code that actually copies the data to the new table. What I will list are the two commands I am using after that code, to close the current form (the one with the button) and open the form for entering special customer information (the form to edit data on my other table). It works flawlessly, but when it opens the other form, it opens to the first record. I want to know how to make it open to the record which I was viewing when I clicked the button to copy the data.
DoCmd.OpenForm "Special Customer Data Entry", , , Number = Me.Number DoCmd.Close acForm, "Customer Data"
This code works well and frmRepair opens with the updated label caption. The original value was "Return/repair Information"
A few other things need to change on frmRepair depending on this caption as well as the values of some other fields, so I use the following code in the onload event (although I later tried the onopen even)
Code: 'Disable labels button if there is no RMA and the item is a repair MsgBox Me.lblmain.Caption If Me.lblmain.Caption = "Return/Repair Information" Then Me.txtRMA.SetFocus MsgBox Me.txtRMA.Text
[Code] ....
However, I cannot get this to work as the "if" statement always returns "Return/Repair information" and not the modified caption. The message box confirms that this is the case.
I suspect that this has to do with the point in time that the frmRepair loads or opens and when my code enters the modified values.
I have a table that holds the SQL texts for ca. 1000 Select queries (mostly minor variants that are used to programmatically swap out RowSource strings for combo boxes). I'd like to have a quick and easy way to open/review/modify these queries.
One strategy would be to display the SQL strings in a field on a Datasheet form, then use an onClick event on a text box linked to the SQL-holding field (or perhaps an onClick event tied to an unbound text box on the form) to open the associated query. That would allow me to view the SQL of the query that I want to open, allow me to quickly scroll through the list of stored SQL texts, and give me options for sorting or limiting the SQL-texts displayed in the datasheet form.
But, I can't seem to get the onClick event to work. The problem seems to be that I can't figure out how to pass the SQL string contained in the field to a function that will use that string to open the query .
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?
I have some code for a button on click event to open a form and select the record which corresponds to a value in an unbound text box. The code is:
Private Sub Command25_Click() On Error GoTo Err_Command25_Click Dim stDocName As String Dim stLinkCriteria As String stDocName = "frmOpenPatientRecord"
[Code] ....
This works fine when I put in a 10 digit NHS number but opens a blank record when I enter a four digit or six character/digit PatientNumber. Both patient number and NHS number are text fields in the underlying table.
Hello, I am trying to find a way to open a form with a subform on a specific record (for the form and the subform), I came up with the following but keep getting a mismatch mistake which means me think I am not doing it right. What would be the apropriate way to achieve what I am trying to do?
Dim stDocName As String
'To Link to 1) Drawing File ID on main form Dim stLinkCriteria As String
'To Link to 2) Drawing ID on subform Dim StLinkCriteria2 As String
Some of the things that bring me screeching halt really surprise me. I swear, this sounds like it should be so easy....
What I need to do is check, when the user clicks on a button, whether a specific table that is going to be modified/deleted later in the click code is already open. If it is open, I will msgbox the user to close the table first and exit the sub.
I have a report, on a control tab, on a main form.
On the form are two buttons: one to show all items, and one to filter them based on a boolean field called showitem.
The buttons work with the code below.
What I want to do but cannot seem to figure out is to have the report default to no filter.
The bound query has no criteria.
I'm trying to set the filter property via the on open or on load event and even if I isolate the report, cannot seem to reach it.
Code: Private Sub b_hide_items_Click() Me.Profile_Timeline_wNotes_subreport.Report.Filter = "timeline.showItem <> 1" Me.Profile_Timeline_wNotes_subreport.Report.FilterOn = True Me.Profile_Timeline_wNotes_subreport.Requery End Sub
Private Sub b_show_all_Click() Me.Profile_Timeline_wNotes_subreport.Report.Filter = "timeline.showItem = 0" Me.Profile_Timeline_wNotes_subreport.Report.FilterOn = False Me.Profile_Timeline_wNotes_subreport.Requery End Sub
There are around 100 customers.And on application open, need to check if customer has paid invoice. If the customer has paid/not paid need to change the status accordingly. Form on open event changes status of only the first customer.Form on current changes status only if we move to the specific record. Is there an event to trigger to check the entire table records on application open?
We have an ActiveX grid control, 10Tec iGrid, written in VB6. One of its method, Group, used to group rows, raises the AfterAutoGroupRowCreated event so the developer can adjust the look and contents of every group row created during the automatic process of grouping.
When our ActiveX grid is hosted on an MS Access form and we call the Group method while populating the grid in the form's Open event, the AfterAutoGroupRowCreated event isn't triggered. But this event definitely works as expected in other development environments, and even in MS Access if we call Group from the form's Load event.
Is it a well know issue of MS Access, when any events of ActiveX controls aren't triggered while "executing" the Open event
In ContactIDForm it contain 1 textbox name 'TextBox' with Button Name 'Btn'
In ContactIDForm there is only 1 Text Box ContactIDTextBox and 1 Button. User Enters ID in TextBox and On Button Click Event it should check data from TextBox in Table name (ContactDetailTable) in field ContactID and if there is record matching, ContactInfoForm should Open else NewContactForm should open with ContactIDTextBox value in it.
when i open a form i want to open another frm at the same time. i have a main form with some buttons in it. when i click on a button and a form opens then i am not able to click on a button to open other forms from the main form.
hi , i am new to access ,specially in designing forms . I have two tables Table1 and Table2 .I have created forms ,Form1 and Form2 respectively. now what i want is ...when i enter the value in Form2 ...Table1 filed should be updated. Table1.field1=Table1.field1-Table2.field1 how can i perform this type of action ?
End Function ````````````` What I am trying to get to is to have the text box event...Private Sub Text0_AfterUpdate() ...... Be a Form event... So the code would apply to every text box on the form. Tried it on different form events..... Cant get it to work. Any ideas????
I'm having troubles understanding and picking the right event for a particular action in forms. For example I want to set the background of a form to "15911239"; which event do I pick? I know that Oncurrent will work but I don't neccessary want to "set the color" whenever the record changes, because setting it once would be enough. However, onOpen gave me an error (i guess the form isn't open yet, while I'm trying to give it a color). OnActive? Some light on this matter would be appreciated and an answer to the above example would help too.
I would like a form I have created to check the value of a text box upon loading the form and also everytime the form loads the next record. Is there an event setting for this? Thank you in advance.
I have a field (AR#) that has an "on change" event. This is supposed to check through the database and see if that number has been here before (it's like a job # / serial #). It had always worked fine - now suddenly this field, and this field only, reacts VERY, VERY slowly when you type a number in. You can type the number and wait about 5 seconds for it to show up. When I removed the event - it acted normally so I think it has to do with that. Here's the vb for the event:
Private Sub AR__Change() Dim db As Database Dim Rst As DAO.Recordset Dim strAR As String Set db = CurrentDb() strAR = Me.AR_.Text Set Rst = db.OpenRecordset("repairs", dbOpenDynaset) Rst.FindFirst "[AR#] = '" & strAR & "'" If Rst.NoMatch Then Else MsgBox ("This value it is already in the system !") End If End Sub
Any ideas why it's reacting so slow or what I should look for?
Is there a way to close a form that is open from another form that has the focus. I tried using the Unload event, but I received an error message "Cant load or unload the object". I would appreciate any help!
Is there a way to cancel a form's close event? If a user clicks the form's close button, I want a msgbox to ask if they are sure, and if yes continue and close, else cancel the forms close event. I know how to perform the msgbox and the if statement. I can not figure out how to cancel the form's close event.
I'm using Access 2K. I have created a Form BeforeUpdate event to check that certain fields in the form have been filled. However, I don't want to do the check until after a subform entry is also complete, but the BeforeUpdate event fires as soon as the subform is entered. Is there any way I can around this?
I created an Event Procedure on the After Update event for a control in a continuous form. Basically, if certain conditions are met, I want it to disable another control. It works perfectly, except it is disabling the controls for all the records instead of just that record.
Does anyone know how to get it to just update that record? I've been researching and cannot figure it out!