473,379 Members | 1,511 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,379 software developers and data experts.

How to pass a GUID from record to record in the same form

I have created a form that allows users to select a model number using a dropdown and click a button to open a sub-form. When it opens the sub-form, it passes the record id, in this case a GUID successfully. However, when the user enters a serial number on the sub-form and goes to the next record, it doesn't pass the GUID. I have been able to pass a simple text string (text29 - for testing) but just not the GUID.

My reason for this is to allow users to enter multiple serial numbers assigned to the same model number without entering the model number in every time. I am a newbie to VBA and Access. So, any help is greatly appreciated.

My code:
Main Form:
Private Sub Command24_Click()
RunCommand acCmdSaveRecord
DoCmd.OpenForm "addMultipleNewInventory"
Forms!addMultipleNewInventory!partsLookupUUID.Valu e = Me!Combo9.Value
Forms!addMultipleNewInventory!Text29.Value = Me!serialNumber.Value
DoCmd.Close acForm, "Add New Inventory", acSaveYes
End Sub

Sub-Form:
Private Sub Form_AfterUpdate()
Me!partsLookupUUID.Value = Me!partsLookupUUID.Value
Me!Text29.Value = Me!Text29.Value
End Sub
Jan 26 '11 #1
2 1601
jimatqsi
1,271 Expert 1GB
James,
Welcome. I think you'll find this site to be a huge help as you learn your way around Access and VBA.

Here is a page I refer to constantly. It helps me get the syntax right for referring to objects on forms and subforms. http://www.mvps.org/access/forms/frm0031.htm

Here are a few other basic. Change the names of your objects to be meaningful names. Command24 and Text29 do nothing to tell the purpose of those objects. And always put error checking into routines. Perhaps if you do that in this case you'll see where your problem lies. Your error checking will be something like this
Expand|Select|Wrap|Line Numbers
  1. On error goto Err_Command24_Click 'put this 1st in the routine
  2. 'put the following code at the end of the routine and all other code goes between the above and the below code
  3.  
  4.    On Error GoTo 0
  5.    Exit Function
  6.  
  7. Err_Command24_Click:
  8.  
  9.     MsgBox "Error " & Err.Number & " (" & Err.Description & ") in procedure GetNewGuid of Class Module Command24_Click"
  10.     Resume Next
End Function

I installed MZ-Tools from http://www.mztools.com/index.aspx. It is a fantastic free tool that puts the error checking in for you automatically with one click.

Now, for your problem, it is not very clear what you are telling about the subform.

It's not clear to me how you expect the information to flow from one form to the other. When your subform is updated there is no useful action taking place. The code
Expand|Select|Wrap|Line Numbers
  1. Me!partsLookupUUID.Value = Me!partsLookupUUID.Value
  2. Me!Text29.Value = Me!Text29.Value
doesn't do anything

I can't tell what "Me" is because I don't know what form's AfterUpdate event is being handled. It looks like it is part of form addMultipleNewInventory. If that's so, then you probably want
Expand|Select|Wrap|Line Numbers
  1. Forms!mainformname!Combo9.Value = me!partsLookupUUID.Value 
  2. Forms!mainformname!serialNumber.Value = me!Text29.Value 
I'm not sure the subform's afterupdate event is the best place for that; maybe you could put it in the oncurrent event of the subform, so even if you don't update anything, if you're just browsing through the file you'll get the same effect. And also then in the afterupdate event of the the specific text boxes or other fields that might be edited.

Hope that helps,
Jim
Jan 26 '11 #2
Thanks, I will look at it some more tomorrow. I will let you know how it goes. I really appreciate your speedy reply.
Jan 26 '11 #3

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

Similar topics

1
by: vishal | last post by:
hi i am using get method to pass data from one form to another and my value may contain & symbol. so when this is case the value after & sign is truncated which is logically true. so what...
9
by: David Allison | last post by:
cmdButton to Print 3 copies of record in Form view ? cmdButton will print 1 but I need 3 copies of the one Form record. -- Dave Allison
0
by: Pete Kane | last post by:
Hello All, I'm a seasoned Foxpro programmer who is just feeling the waters of C# using InterOp. Is it possible to pass a Visual Foxpro form object to a ..NET dll method and have the method set some...
4
by: Ronald S. Cook | last post by:
I have a form open and when a user clicks a button I do a frmNew.Show() and this.Hide. But I have a value that I need to pass to the new form. How can I do this, please? Thanks very much, Ron
0
by: Jon Paal | last post by:
how can I pass conventional html upload form to asp.net page for processing / like : (which currently does not work) <form name="userForm" action="upload.aspx" ENCTYPE="multipart/form-data"...
8
by: Ragbrai | last post by:
Howdy all, I have a form for entering data (Form A), on which is a cmd button that opens Form B in acdialog mode to allow me to enter/edit records that are being displayed on Form A. After...
1
by: Rathi R | last post by:
Hi, I am new to this forum. I am working on Ms-Access. Based on the data in various tables i am generating a form. In that form, the calculated values have to be displayed one after the other i.e as...
2
by: Tom Clavel | last post by:
Scratching my head. I am using the filter property on a combo box .AfterUpdate event to get to a single client record. This is causing a some strange behavior: As I enter a subform, I get a no...
7
by: Boki | last post by:
Hi All, I can't pass data to another form: in form2: private void button1_Click(object sender, EventArgs e) { Form1 form_copy = new Form1();
4
by: barkarlo | last post by:
I use check box in a form "frmworkorder" like confirmation that's record finish. How can I write code who will block edit and delete record in form when is check box confirmed.
1
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...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...

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.