1acab Visual Basic & Access Newbie - Help!
Sign Up |  Live StatsLive Stats    Articles 37,467| Comments 178,613| Members 19,494, Newest Kartarsingh| Online 350
Home Contact
 (Forgotten?): 
    10 years of Excellence
    For best SPN experience, use Firefox Internet Browser!


                                                                   Your Banner Here!    




Click Here to Register/Sign Up Daily Hukamnama Member Blogs Downloads Website Navigation Help Fonts Tags

Visual Basic & Access Newbie - Help!

Our Donation Goal : Why Donate? : Donate Today! : Donate Anonymously (ਗੁਪਤ) : Our Family of Supporters
Goal this month: 500 USD, Received: 0 USD (0%)
Please Donate...
     
Related Topics...
Thread Thread Starter Forum Replies Last Post
Visual Basic Editor Ronnie Information Technology 5 28-Jul-2006 08:34 AM
Visual Basic wammac Information Technology 3 28-Jul-2006 08:05 AM
PLEASE READ IF YOU PROGRAM: Help Continue Visual Basic Mike Information Technology 5 15-Nov-2005 14:11 PM
How to add a filter in Visual Basic? danijela.simunovic@gmail.com Information Technology 1 01-Nov-2005 13:40 PM
RE: F8 disabled in Access/Visual Basic joop Information Technology 2 29-Oct-2005 12:35 PM


Tags
visual, basic, access, newbie, help
Reply Post New Topic In This Forum Stay Connected to Sikhism, Click Here to Register Now!
  #1 (permalink)  
Old 28-Oct-2005, 17:59 PM
gjoneshtfc@volcanomail.com's Avatar gjoneshtfc@volcanomail.com
Guest
 
Posts: n/a
   
   
Visual Basic & Access Newbie - Help!

  Donate Today!   Email to Friend  Tell a Friend   Show Printable Version  Print   Contact sikhphilosophy.net Administraion for any Suggestions, Ideas, Feedback.  Feedback  

Register to Remove Advertisements
Hello

I have never used VB before but have been asked to look at coding a
Reference:: Sikh Philosophy Network http://www.sikhphilosophy.net/information-technology/5981-visual-basic-and-access-newbie-help.html
button in Microsoft Access. The button currently exits a form and opens
a new form and works great. However, when the new form opens i want it
to open with information about the record i had open in the previous
form.

For example: I am looking at a record for everything to do with invoice
number 50 in the first form. The second form is the invoice print
layout that i open if i need to print the invoice information alone.
Reference:: Sikh Philosophy Network http://www.sikhphilosophy.net/showthread.php?t=5981
When i click on the button in the first form i need to have invoice
number 50 open in the second form.

Ideally i need to store the record number and then have it open in the
next form - if this is possible??!! Alternatively i could store the
stock number or invoice number and then have the button find the record
in the next form. I have tried a few things but they all give errors or
fail to work!

Any help will be greatly appreciated.

Regards, Gareth Jones



Do you agree or disagree with the writer above? Why not share your immediate thoughts with us! Login Now! or Sign Up Today! to share your views... Gurfateh!
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 28-Oct-2005, 18:00 PM
rico's Avatar rico
Guest
 
Posts: n/a
   
   
RE: Visual Basic & Access Newbie - Help!

Gareth,

I think the solution is much simpler. I'm assuming the only reason to open
the second form is to print the information in the first?

Assuming this is correct, my first suggestion would be to make the second
form a report and not a form, as these are design to be for printing, were
forms are not.(Have a look at the reports in the northwind database for
examples of how reports work).

Then in the button you are reffering to you would need something like the
following:

Docmd.openreport "TheReport",,,"[FormOneID]=" & Me![ReportID]"

This 'opens' the report which has the same primary id number as your form,
prints it then closes it.

If you want to see your report before you print it change the above to:

Docmd.openreport "TheReport",acViewPreview,,"[FormOneID]=" & Me![ReportID]"

Hope i have understood your situation correctly.

HTH

Rico

"gjoneshtfc@volcanomail.com" wrote:

> Hello
>
> I have never used VB before but have been asked to look at coding a
> button in Microsoft Access. The button currently exits a form and opens
> a new form and works great. However, when the new form opens i want it
> to open with information about the record i had open in the previous
> form.
>
> For example: I am looking at a record for everything to do with invoice
> number 50 in the first form. The second form is the invoice print
> layout that i open if i need to print the invoice information alone.
Reference:: Sikh Philosophy Network http://www.sikhphilosophy.net/showthread.php?t=5981
> When i click on the button in the first form i need to have invoice
Reference:: Sikh Philosophy Network http://www.sikhphilosophy.net/showthread.php?t=5981
> number 50 open in the second form.
>
> Ideally i need to store the record number and then have it open in the
> next form - if this is possible??!! Alternatively i could store the
> stock number or invoice number and then have the button find the record
> in the next form. I have tried a few things but they all give errors or
> fail to work!
>
> Any help will be greatly appreciated.
>
> Regards, Gareth Jones
>
>

Reply With Quote
  #3 (permalink)  
Old 28-Oct-2005, 18:00 PM
rico's Avatar rico
Guest
 
Posts: n/a
   
   
RE: Visual Basic & Access Newbie - Help!

Sorry just realised i got the where condition the wrong way round, should be
Reference:: Sikh Philosophy Network http://www.sikhphilosophy.net/showthread.php?t=5981
as follows:

Docmd.openreport "TheReport",,,"[ReportID]=" & Me![FormOneID]"

HTH

Rico

"gjoneshtfc@volcanomail.com" wrote:

> Hello
>
> I have never used VB before but have been asked to look at coding a
> button in Microsoft Access. The button currently exits a form and opens
> a new form and works great. However, when the new form opens i want it
> to open with information about the record i had open in the previous
> form.
>
> For example: I am looking at a record for everything to do with invoice
> number 50 in the first form. The second form is the invoice print
Reference:: Sikh Philosophy Network http://www.sikhphilosophy.net/showthread.php?t=5981
> layout that i open if i need to print the invoice information alone.
> When i click on the button in the first form i need to have invoice
> number 50 open in the second form.
>
> Ideally i need to store the record number and then have it open in the
> next form - if this is possible??!! Alternatively i could store the
> stock number or invoice number and then have the button find the record
> in the next form. I have tried a few things but they all give errors or
> fail to work!
>
> Any help will be greatly appreciated.
>
> Regards, Gareth Jones
>
>

Reply With Quote
  #4 (permalink)  
Old 28-Oct-2005, 18:00 PM
gjoneshtfc@volcanomail.com's Avatar gjoneshtfc@volcanomail.com
Guest
 
Posts: n/a
   
   
Re: Visual Basic & Access Newbie - Help!

Hello Rico

Thanks for the reply first of all!

Second of all you assume correct. I am trying the report option now.
The reason i was using a form is because the person who wants this
database wants to be able to edit the information after clicking
Reference:: Sikh Philosophy Network http://www.sikhphilosophy.net/showthread.php?t=5981
invoice. (I know it makes no sense as she could edit it in the first
form but she's the client!!)

My VB skills are very weak (actually non-existing!) so may have some
questions about the code you wrote if i cant get it to work!

Actually... have just tried it... I get errors. In your code you have
one speach mark at the end. Is this correct as it is not matched to
anything else? Also, what is Me! - do i need to change that to
Reference:: Sikh Philosophy Network http://www.sikhphilosophy.net/showthread.php?t=5981
something in my DB? My FormOneID bit is "[Stock No]=" and my ReportID
bit is Me![Stock No] currently.

Thanks again for your help
Regards, Gareth

Reply With Quote
  #5 (permalink)  
Old 28-Oct-2005, 18:00 PM
rico's Avatar rico
Guest
 
Posts: n/a
   
   
Re: Visual Basic & Access Newbie - Help!

Sorry Gareth rushed the code didn't check it properly, i'll try again:

DoCmd.OpenReport "NameofReport", , , "[Stock No] = " & Me![Stock No] & ""

This SHOULD work .
Reference:: Sikh Philosophy Network http://www.sikhphilosophy.net/showthread.php?t=5981

He 'Me' mean the current form, saves you writing '[Forms]![MyFormName]',
when you are reffering to controls within the current form.

Also, bad idea to have spaces in your control names, will be fine most of
the time, but eventually will give you problems.

Regards

Rico

"gjoneshtfc@volcanomail.com" wrote:
Reference:: Sikh Philosophy Network http://www.sikhphilosophy.net/showthread.php?t=5981

> Hello Rico
>
> Thanks for the reply first of all!
>
> Second of all you assume correct. I am trying the report option now.
> The reason i was using a form is because the person who wants this
> database wants to be able to edit the information after clicking
> invoice. (I know it makes no sense as she could edit it in the first
> form but she's the client!!)
>
> My VB skills are very weak (actually non-existing!) so may have some
> questions about the code you wrote if i cant get it to work!
>
> Actually... have just tried it... I get errors. In your code you have
> one speach mark at the end. Is this correct as it is not matched to
> anything else? Also, what is Me! - do i need to change that to
> something in my DB? My FormOneID bit is "[Stock No]=" and my ReportID
> bit is Me![Stock No] currently.
>
> Thanks again for your help
> Regards, Gareth
>
>

Reply With Quote
  #6 (permalink)  
Old 28-Oct-2005, 18:00 PM
gjoneshtfc@volcanomail.com's Avatar gjoneshtfc@volcanomail.com
Guest
 
Posts: n/a
   
   
Re: Visual Basic & Access Newbie - Help!

Hey

Thanks again for the reply... I now get the error message:
Reference:: Sikh Philosophy Network http://www.sikhphilosophy.net/showthread.php?t=5981

"Data type mismatch in criteria expression"

It doesnt even open the report anymore!

Any ideas?

Regards, Gareth

Reply With Quote
  #7 (permalink)  
Old 28-Oct-2005, 18:00 PM
rico's Avatar rico
Guest
 
Posts: n/a
   
   
Re: Visual Basic & Access Newbie - Help!

  Donate Today!  
This means that the datatype of your two ID's are not the same. Go to tables
Reference:: Sikh Philosophy Network http://www.sikhphilosophy.net/showthread.php?t=5981
that supply both and check 'DataType' and 'fieldsize'. If they are not the
same you will not be able to reference them to each other untill they are the
same. This also suggests to me that maybe you are not using a unique ID for
stock no.

HTH

Rico

"gjoneshtfc@volcanomail.com" wrote:
Reference:: Sikh Philosophy Network http://www.sikhphilosophy.net/showthread.php?t=5981

> Hey
>
> Thanks again for the reply... I now get the error message:
>
> "Data type mismatch in criteria expression"
>
> It doesnt even open the report anymore!
>
> Any ideas?
>
> Regards, Gareth
>
>

Reply With Quote
  #8 (permalink)  
Old 28-Oct-2005, 18:00 PM
gjoneshtfc@volcanomail.com's Avatar gjoneshtfc@volcanomail.com
Guest
 
Posts: n/a
   
   
Re: Visual Basic & Access Newbie - Help!

Hey,

There is only one table that contains the Stock No - its primary key so
it is unique. Both forms take the stock number from that table so it is
Reference:: Sikh Philosophy Network http://www.sikhphilosophy.net/showthread.php?t=5981
the same - confusing huh?!

Thanks again
Gareth

Reply With Quote
  #9 (permalink)  
Old 28-Oct-2005, 18:00 PM
rico's Avatar rico
Guest
 
Posts: n/a
   
   
Re: Visual Basic & Access Newbie - Help!

The only thing i can think of is that if the datatype of Stock No is not a
number (which i doubt it is) you would need to change the code slightly:

DoCmd.OpenReport "Report", , , "[Stock No] = '" & Me![Stock No] & "'"



"gjoneshtfc@volcanomail.com" wrote:
Reference:: Sikh Philosophy Network http://www.sikhphilosophy.net/showthread.php?t=5981
Reference:: Sikh Philosophy Network http://www.sikhphilosophy.net/showthread.php?t=5981

> Hey,
>
> There is only one table that contains the Stock No - its primary key so
> it is unique. Both forms take the stock number from that table so it is
> the same - confusing huh?!
>
> Thanks again
> Gareth
>
>

Reply With Quote
   Click Here to Donate Now!

Support Us!
Become a Promoter!
Gurfateh ji, you can become a SPN Promoter by Donating as little as $10 each month. With limited resources & high operational costs, your donations make it possible for us to deliver a quality website and spread the teachings of the Sri Guru Granth Sahib Ji, to serve & uplift humanity. Every contribution counts. Donate Generously. Gurfateh!
ReplyPost New Topic In This Forum Stay Connected to Sikhism, Click Here to Register Now!

Bookmarks


(View-All Members who have read this thread : 0
There are no names to display.

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Tools Search
Search:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On
Trackbacks are On
Pingbacks are On
Refbacks are On

» Active Discussions
What Really Happened on...
Today 05:36 AM
10 Replies, 128 Views
English Sri Guru Granth Sahib Ji Translations
By sikh15
Today 04:47 AM
0 Replies, 6 Views
Free Online Gurbani...
Today 03:56 AM
13 Replies, 4,298 Views
English Sri Guru Granth...
Today 03:51 AM
5 Replies, 135 Views
Edward Snowden: the...
Today 03:34 AM
3 Replies, 110 Views
Difference in Bowing...
Today 03:31 AM
10 Replies, 221 Views
Rozana Reports (ਪੰਜਾਬੀ...
Today 03:23 AM
407 Replies, 9,381 Views
Sikh Spokesman (ਪੰਜਾਬੀ...
Yesterday 17:57 PM
255 Replies, 6,016 Views
What Is Difference...
Yesterday 09:18 AM
6 Replies, 174 Views
First There is Water by...
By Ishna
Yesterday 05:03 AM
3 Replies, 189 Views
Cooking Without Alcohol
Yesterday 02:12 AM
12 Replies, 188 Views
Learning from Baba...
Yesterday 01:38 AM
0 Replies, 309 Views
Eckhart Tolle
17-Jun-2013 18:08 PM
2 Replies, 118 Views
Thought of the Moment!
17-Jun-2013 16:35 PM
115 Replies, 6,076 Views
New Quantum Dot...
17-Jun-2013 09:38 AM
0 Replies, 61 Views
» Books You Should Read...
Powered by vBadvanced CMPS v3.2.3
All times are GMT +6.5. The time now is 05:37 AM.
Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2013, vBulletin Solutions, Inc.
Search Engine Optimization by vBSEO 3.6.0 PL2 Copyright © 2004-12, All Rights Reserved. Sikh Philosophy Network


Page generated in 0.51039 seconds with 32 queries
0