473,624 Members | 2,026 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

browseto nightmare

5 New Member
Hi all,

First post, but long time browser.

I have been using browseto over the years with mostly a good outcome, however I have now encountered some strange behaviour.

I have a button which onclick changes to a different form. I can make this work fine, however on the onclick before the browseto command I have some vba code to check that all data on the form is correct before moving on.

The vba code is very simple, eg
Expand|Select|Wrap|Line Numbers
  1. If Text52 < 0 And Text61 > 0 Then
  2. P1answer = MsgBox("You have put different sign powers, do you want to edit?", vbQuestion + vbYesNo + vbDefaultButton2, "TEST")
  3. If P1answer <> 7 Then
  4. Exit Sub
  5. End If
  6. End If
Very simple stuff, however code as simple as that will cause the browseto to runtime 6054 error.

If someone clicks "no", it results in a runtime error 6054.

If someone clicks "yes", then tries to click the button again, and then clicks "no", it works second time as intended.

I have tried simplifying the code to things a simple as if 1>0 etc, however it seems any statement seems to trigger a browseto error on this form.

Any ideas?
Jun 28 '21 #1
8 4414
NeoPa
32,567 Recognized Expert Moderator MVP
Hi there, & welcome to Bytes.com.

Let me start by pointing out that 6054 is an error code. With an error code you will always have the message that code represents, which makes the error make sense to anyone trying to help. That makes life easy, which is why it's always provided.

Your further explanation discusses what happens when the code is run again - yet doesn't explain the logic you're using that makes that possible.

I don't see what's wrong here, but I also only see a fraction of what I need to in order to understand what it is you should be explaining to me (us).

At no point does the code reference, or illustrate, any interaction with BrowseTo.
Jun 29 '21 #2
hilmi123
5 New Member
Hi NeoPa,

Let me try to explain further.

"let me start by pointing out that 6054 is an error code. With an error code you will always have the message that code represents, which makes the error make sense to anyone trying to help. That makes life easy, which is why it's always provided."

The error code I have uploaded an image to illustrate, it suggests the path to the browsed form is incorrect.

This is not the case. As I mentioned, if I remove the simple code that has no bearing on the path, the browseto works fine.

Even if I leave the code in, it works if I click the button which references the browse to code on the second attempt.

"Your further explanation discusses what happens when the code is run again - yet doesn't explain the logic you're using that makes that possible."

So I have a button, when the button is clicked, it will do some checks on the data on a subform, and if all is ok, it will change the form in the subform to a different one. However if the data is not correct, it will show a prompt to the user to check the data. If they select that they are happy with the data, then the VBA will attempt the browseto, at this point the error 6054 will appear. If the user opts to change the data, but actually does nothing, then when then the data check prompts shows again (because the data is still questionable), if the user opts this time to say the data is fine, the browseto code is used and it works without any errors.

"At no point does the code reference, or illustrate, any interaction with BrowseTo."

This is the problem Im trying to fix. The browseto works in isolation, but not when used in certain mundane situations.

For reference, here is the browseto Im using.

Expand|Select|Wrap|Line Numbers
  1. DoCmd.BrowseTo ObjectType:=acBrowseToForm, _
  2. ObjectName:="Patients", _
  3. PathToSubformControl:="Main Menu.NavigationSubform", _
  4. WhereCondition:="[Patient ID] =" & Me.PatientID, _
  5. DataMode:=acFormEdit
This all suggests there is nothing wrong with the code per se, but there is a bug in Access. What Im looking for is either some help understanding browseto command or a work around, does anyone have an ideas?
Attached Images
File Type: jpg 6054.jpg (19.7 KB, 52 views)
Jun 29 '21 #3
isladogs
458 Recognized Expert Moderator Contributor
In over 20 years of using ACCESS, I cannot recall ever using BrowseTo in my own code.
Please can you explain what you are using it for. There may well be another/better approach.
Jun 29 '21 #4
hilmi123
5 New Member
isladogs,

I have a navigation set up with buttons on the left side.

The "main menu" is always open, and the changeable subform is "NavigationSubf orm".

So for example lets imagine I am on form x and I want to go back to the "home" form for the NavigationSubfo rm, I would use a browseto command to change the form loaded in the NavigationSubfo rm.

The problem is, if you search you will find the browseto command is at best buggy, but basically not working. You can have it working, and then change something completely unrelated and then it will stop working. I noted on this forum there are countless examples.
Jun 29 '21 #5
NeoPa
32,567 Recognized Expert Moderator MVP
Hilmi123:
The error code I have uploaded an image to illustrate, it suggests the path to the browsed form is incorrect.
Please don't do it that way. Anyone reading this would have to link to the image file just in order to understand the question. That isn't cool. Many can't even do so due to restrictions - especially if looking from a work environment - but even if they could it's not everyone else's job to work out what the question should be.

Nevertheless, we do at least have an error message now :
Access Error:
Run-time error '6054':

The macro action BrowseTo requires a valid Path argument. A valid Path argument is of the form: MainForm1.Subfo rm1>Form1.Subfo rm1
I struggle to work out what it's trying to say - but one thing is very clear :
It requires a valid Path argument. Except of course there is no Path argument from what I can see. I assume it must be referring to the PathtoSubformCo ntrol argument. I admit to being a little confused by the format indicated as required within the error message but I would lay money it's not going to like a space in the name without [] around it. That's pretty much a given. What else it's trying to say confuses me. Luckily I don't use it myself but I agree that some better explanation and clearer instructions would be helpful.
Hilmi123:
This all suggests there is nothing wrong with the code per se, but there is a bug in Access.
I disagree. I think it indicates you have a limited understanding of the tools you're trying to use. No great shame there - I find it very confusing myself. However, we're a long way from that statement at this point as far as I can see. Fix the obvious errors first then think about Access being wrong. I'll support "Access explains things unhelpfully at times.", but that's as far as I see for now.

So, from all I've seen so far and I've read to the end at this point, you have a main Form called [Main Menu]. On this main Form you have a Subform Control named [NavigationSubfo rm] and your intention at different stages of your process is to show different Form objects within this same Subform Control on your main Form.
Hilmi123:
The problem is, if you search you will find the browseto command is at best buggy, but basically not working. You can have it working, and then change something completely unrelated and then it will stop working. I noted on this forum there are countless examples.
As IslaDogs hinted at, there are better ways of handling what you want to do. Generally speaking I avoid macro actions where possible - even when instigated via DoCmd. They can be really useful to have available but where options exist to manage things via the objects themselves I prefer to use that approach.

Your asking of questions may leave a bit to be desired but I'm seeing a level of programming competence such that this shouldn't frighten you. Subform Controls have three very important Properties beyond their names - [SourceObject], [LinkChildFields] & [LinkMasterField s]. By playing with these you can roll your own code to switch the Forms used within a Subform Control. That's how I'd do it. Obviously (I hope.) be very careful of how you use names of objects. If you have to include spaces then you'll have to learn how to refer to them properly. Avoid spaces in names for an easier life.

Sorry for the long post - but you've asked an interesting question and it deserves a detailed answer.
Jun 29 '21 #6
hilmi123
5 New Member
Hi NeoPa,

Thanks for trying, but I dont think you understand.

In reality this is a very simple situation.

The code to change the form in navigationsubfo rm works in some situations and not others. The factor that makes it not work is the code that is running before the BrowseTo cmd.

Eg if there is a dialogue box in my case.

So this works

Expand|Select|Wrap|Line Numbers
  1. DoCmd.BrowseTo ObjectType:=acBrowseToForm, _
  2. ObjectName:="Patients", _
  3. PathToSubformControl:="Main Menu.NavigationSubform", _
  4. WhereCondition:="[Patient ID] =" & Me.PatientID, _
  5. DataMode:=acFormEdit
Expand|Select|Wrap|Line Numbers
  1. If Me.Text74 = 0 And Forms("Main menu").Text242 > 42 Then
  2. ' R no add
  3. Ranswer = MsgBox("Are you sure blah blah", vbQuestion + vbYesNo + vbDefaultButton2, "PMS")
  4. If Ranswer <> 7 Then
  5. Exit Sub
  6. End If
  7. End If
  8.  
  9. DoCmd.BrowseTo ObjectType:=acBrowseToForm, _
  10. ObjectName:="Patients", _
  11. PathToSubformControl:="Main Menu.NavigationSubform", _
  12. WhereCondition:="[Patient ID] =" & Me.PatientID, _
  13. DataMode:=acFormEdit
  14.  
  15.  
That does not work, it results in the RTE 6054. The error also be triggered by running any kind of DAO.
Jul 6 '21 #7
PeterTheme
1 New Member
Hi Hilmi123
My thought is that Me.PatientID may not be set correctly and the PathError is just misleading. You may want to try using aTempvars in place of the Me.PatientID.

Looking at the name of the Navigation form you appear to be using the Navigation control. On the "Data" tab of your Navigation buttons you will find properties "Navigation Target Name" and "Navigation Where Clause" so you can avoid using BrowseTo. You would need to set DataMode in the form Open or Load event.

I only occasionally use BrowseTo on my Navigation forms if the Button data settings won't provide sufficient control.

The only bug I have found in Navigation controls, that was acknowledged by Microsoft, was in 2010 runtime version. It only failed when there were 2 rows of horizontal navigation buttons. It worked fine in full Access.
Jul 7 '21 #8
NeoPa
32,567 Recognized Expert Moderator MVP
Hilmi123:
Thanks for trying, but I dont think you understand.

In reality this is a very simple situation.
Excellent. You seem to be understanding the situation better now. I can't understand what you're saying until what you're saying starts to make some sense & include the information I need in order to understand what you're saying.

It's a simple situation too. Excellent. I'm sure that sometime soon you'll manage to explain it clearly then. All the clues as to what you need to do in order to make sense are in my earlier posts. I'm sure we can make some progress soon if you read what I say and post something that makes your situation clear.

Alternatively, if you continue simply to repeat what we already know to be very unclear then I will stay confused and will not be able to help you further.
Jul 7 '21 #9

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

Similar topics

1
2296
by: Drisco | last post by:
Hello, I realy need help,Searched the NG for a days with no vail. Sorry for the long script. I am trying to get a variable from php to flash. I have the following code in php <a href="artist_page.php?12345678=<?php echo $row_rs_Q_Gender_to_Artist; ?>"><?php echo $row_rs_Q_Gender_to_Artist; ?></a>
0
1374
by: Deena | last post by:
Hi Windows forms layout is turning to be a nightmare. I add my controls to a form and then save it and then it just get's all messed up. I'm using inheritance if this makes any difference. Also after trying to fix this multiple times has caused my labels to to be invisible(Yes the visible property is set to true.) Are there any strategies I can use to achieve a stable layout. Why does this happen?
4
3040
by: Dave | last post by:
Hello All, I am having a nightmare trying to add a new row to my Datagrid. When I use the code below I get the error: 'Invalid CurrentPageIndex value. It must be >= 0 and < the PageCount. Can anyone help me with this? Dim dg2 as DataGrid = DG.Items(0).FindControl("dg2") DSClass = Session("DSClass") dt = DSClass.Tables(0)
6
1347
by: Jim Mirra | last post by:
Hey, I have been working on this for a while now and I keep getting the same error. here is my code: ------- start code --------- Dim strSQL = "Select tagid,itemid,description,status, transtype, (select max(datetime) from transactions where tagid = inventory.tagid) as statusdate
2
2278
by: Afshar | last post by:
Dear nice people around the world! Please help ending this nightmare, I have 2 problem with ASP.NET Menu control First: I have a horizontal menu at top of my page, each item have some sub-items that sometimes wont open at exact below their parent item. They open 4 cm left of their correct location! and when I want to select one of them, they disappear!!! In other hands I can't use them. This Menu is produced programatically in Code...
3
1580
by: Samuel Shulman | last post by:
I get the following error Error 2 Could not load file or assembly 'RusticiSoftware.ScormContentPlayer.Logic, Version=2006.1.2576.40320, Culture=neutral, PublicKeyToken=xyzxyxyzyxyzyxzyxy' or one of its dependencies. The located assembly's manifest definition does not match the
10
2107
by: Andrew Wan | last post by:
I have been having a nightmare with ASP/ASP.NET & IIS6. We use Msxml2.DOMDocument.4.0 object to create a XML object in ASP. The Msxml2.DOMDocument.4.0 is from the Windows Platform SDK Feb 2003 (the last version compatible with VC6). Then we use TranslateXSLT(XMLDocument.transformNode) passing in a xsl file path. Our pages work perfectly fine under IIS5 & IIS6 onsite. However strange things happening at our clients IIS6: -...
1
1283
by: =?Utf-8?B?TWVyZGFhZA==?= | last post by:
I am using ASP.NET 2.0 C# I am getting errors when I publish my site. It works fine on our local server. Pages that have maintainscrollpositiononpostback=true set, get errors such as: "loaded with error"; webform_savescrollpositionsubmit not found. View source says page is loking for websource.axd.
12
4214
by: CharT | last post by:
I could use some help with the BrowseTo feature in access 2010. I have searched for and read everything I can find on the web... which wasn't much. Can browseto be used on a form other than a navigation form, if so, how do you set the file path? I have tried to follow the examples given here: http://blogs.office.com/b/microsoft-access/archive/2010/02/23/access-2010-browseto-docmd-and-macro-action.aspx and I can't get it to work. I see a...
7
9227
hyperpau
by: hyperpau | last post by:
Hi All, It's nice to be back. I just got my hands on Access again and I was surprised that the magic is still there. However, the new Navigation Forms in 2010, replacing the switchboard, is new to me. Nevertheless, I figured it out right away, except with one issue. I can't seem to get the acDataMode to work! No matter what I choose, acFormEdit, acFormAdd, asFormReadOnly, etc, access seem to ignore this and just simply browses to the...
0
8238
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8680
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8624
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8336
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7164
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5565
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4082
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2607
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1786
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.