473,385 Members | 2,210 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Trying to click a button on one form from another

KirkT
5
Hello all. I am creating a access database that goes out to all of our databases, open them and select the backup button.

I can open the database and get to the right form but I haven't been able to figure out the button.

I receive a run-time error '438':
Object doesn't support this property or method

I appreciate everything that anyone can do for me.

KirkT

This is my code.

Expand|Select|Wrap|Line Numbers
  1. Public Sub RVS_Q53()
  2.  
  3.     Dim strDB As String
  4.  
  5.     ' Initialize string to database path.
  6.     Const strConPathToSamples = "O:\Requirements " _
  7.     & "Group\Working Folder\Kirk Wallace\Databases\RVS Q53 test RMD\"
  8.  
  9.     strDB = strConPathToSamples & "MASTER RVS Q-53 V3 FE.accdb"
  10.     ' Create new instance of Microsoft Access.
  11.     Set appAccess = _
  12.     CreateObject("Access.Application")
  13.     ' Open database in Microsoft Access window.
  14.     appAccess.OpenCurrentDatabase strDB
  15.     ' Open Orders form.
  16.     appAccess.DoCmd.OpenForm "Admin_Main"
  17.  
  18.     Forms.Admin_Main.Backup_Click
  19.  
  20. End Sub
  21.  
Jun 14 '17 #1

✓ answered by PhilOfWalton

OK, try after your appAccess.DoCmd.OpenForm "Admin_Main" statement

Expand|Select|Wrap|Line Numbers
  1.     Dim Frm As Form
  2.     Set Frm = AppAccess.Forms!Admin_Main
  3.     Call Frm.Backup_Click
  4.  
  5.     AppAccess.Forms.DoCmd.Close AcForm, Me.Name
  6.     Set Frm = Nothing
  7.  
  8.     Set AppAccess = Nothing    
  9.  
Phil

7 1814
PhilOfWalton
1,430 Expert 1GB
A few pointers, but I'm afraid no solution
1) I think this question would have been better under the heading of Access rather than Visual Basic

2) All modules should have
Expand|Select|Wrap|Line Numbers
  1. Option Compare Database
  2. Option Explicit
  3.  
at the head of the module. I suspect that yours does not gave "Option Explicit" as you would have received a compile error on the line beginning
Expand|Select|Wrap|Line Numbers
  1. Set appAccess ........
  2.  
As far as I know, you almost certainly can't run "cmdTest_Click()" as it is a Private Sub and Private means Private and can only be run from within that module.

I think you need to write a Public Sub or Function called "Backup" that runs whatever your cmdTest_Click() does.

Then replace your line "Forms.Admin_Main.Backup_Click" with
Expand|Select|Wrap|Line Numbers
  1. Application.Run ("Backup")
  2.  
Phil
Jun 14 '17 #2
KirkT
5
Phil,

Thank you for your response. My module does have Option Compare Database and Option Explicit in the header. Also, the sub is set to public.

I need to run the code that are in the databases that I am backing up because of path issues.

I would appreciate anyone's help on this issue. Once again, thanks Phil.

Kirk
Jun 15 '17 #3
PhilOfWalton
1,430 Expert 1GB
OK, try after your appAccess.DoCmd.OpenForm "Admin_Main" statement

Expand|Select|Wrap|Line Numbers
  1.     Dim Frm As Form
  2.     Set Frm = AppAccess.Forms!Admin_Main
  3.     Call Frm.Backup_Click
  4.  
  5.     AppAccess.Forms.DoCmd.Close AcForm, Me.Name
  6.     Set Frm = Nothing
  7.  
  8.     Set AppAccess = Nothing    
  9.  
Phil
Jun 15 '17 #4
KirkT
5
Phil,

That works great up until the following line:
Expand|Select|Wrap|Line Numbers
  1. AppAccess.Forms.DoCmd.Close AcForm, Me.Name
It gives me an error at that point. I get a runtime error '438'. Object doesn't support this property or method.

I really do appreciate your help.

Kirk
Jun 19 '17 #5
PhilOfWalton
1,430 Expert 1GB
Hi Kirk

Not sure. Try
Expand|Select|Wrap|Line Numbers
  1. AppAccess.DoCmd.Close acForm, Frm.Name
  2.  
Phil
Jun 19 '17 #6
KirkT
5
Phil,

That worked awesome. I do have another question for you, I am backing the databases up to a Backup folder and overwriting the existing databases. Do you know how make so the Replace confirmation screen doesn't show up and it just automatically replaces the old backup?

Once again, thank you.

Kirk
Jun 19 '17 #7
PhilOfWalton
1,430 Expert 1GB
Not without knowing your backup routine.

Anyway, it's not a very good idea just overwriting. Much safer is to create a new backup file with date embedded in the name e.g. Backup19-Jun-17.Bak. When the older backup files are DEFINATELY not wanted, then delete them manually.

So depending on what you want and your backup routine come back to this forum.

Phil
Jun 19 '17 #8

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: yfng | last post by:
In a web form, I want the user clicks on one button and this button will trigger another button/link which will open a new browser window? How to do that? Is there any method like...
0
by: [Yosi] | last post by:
I search solution for a little bit strange problem , I working on an application which includes a button. Click on this button will create number of threads each one execute deferent executable...
5
by: Steve | last post by:
Hi, Is it possible to make hitting the enter key in an ASP textbox run the code behind an ASP button on a form? I have a search page which users tend to type in the query then just hit enter...
1
by: bradw2k | last post by:
I have one frame that needs to cause a button click event on another frame. I was trying to do this by putting a display:none LinkButton on the target frame, and having a javascript on that page...
3
by: eddie69 | last post by:
Hi, Newbie question here: I am creating an application in VB Studio 2005 which reads the status of an USB PIR Motion sensor. So far, I have managed to get the application to read the motion...
12
by: Thammarat charoenchai. | last post by:
Hi, I'm try to learn vb.net. in delphi have .click method for click button by coding. Can I do that with vb.net Thank you very much.
0
by: adalyc | last post by:
I NEED SOME GUIDENCE WITH UPDATING A COLLECTION OF ITEMS IN A LIST BOX WHEN THE USER CLICKS ON A BUTTON FROM ANOTHER FORM,, i HAVE LISTED THE PROBLEM PARTIALLY. I fIGURED OUT MOST OF THE PROBLEM...
18
by: wizdom | last post by:
Help - change text on click - text has another onclick inside with php variables ---------- I think what I'm trying to do is simple. I have a 2 buttons on a page. 1 button allows a thread of...
0
by: Magkas | last post by:
Hello All .. I'm Trying to Click a Button In Another Application With Process Name "CenterBot" I have got ListView1 , Button1 , Button2 Here's my code Imports System.Runtime.InteropServices...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.