A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Opening a Form



 
 
Thread Tools Display Modes
  #1  
Old April 21st, 2009, 05:48 PM posted to microsoft.public.access.forms
Hank
external usenet poster
 
Posts: 121
Default Opening a Form

I have 2 forms that are tied to the same record. My Key Field is a Customer
Order Number That is Created on the Fly but not autonumber. I didn't use the
2nd. form as a subform because it is as large as the 1st. and really would
not apply to the scheme of things. If I open the 1st. form in edit view and
use the button to navigate to the 2nd. form all is okay. But if I am entering
a New Record, the 2nd form does not populate the Table. How do I adjust my
coding for this. I am kinda lost here. Code for the button follows:

Private Sub Command235_Click()
On Error GoTo Err_Command235_Click

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "Logistics & Routing"

stLinkCriteria = "[CustOrderNum]=" & Me![BillOfLadingTxt]
DoCmd.OpenForm stDocName, , , stLinkCriteria

Exit_Command235_Click:
Exit Sub

Err_Command235_Click:
MsgBox Err.Description
Resume Exit_Command235_Click

End Sub

Thanks

  #2  
Old April 21st, 2009, 06:27 PM posted to microsoft.public.access.forms
ruralguy via AccessMonster.com
external usenet poster
 
Posts: 1,172
Default Opening a Form

You will need to save the record before the 2nd form can see it. Before
opening the other form add
If Me.Dirty then Me.Dirty = False
...to save the record.

Hank wrote:
I have 2 forms that are tied to the same record. My Key Field is a Customer
Order Number That is Created on the Fly but not autonumber. I didn't use the
2nd. form as a subform because it is as large as the 1st. and really would
not apply to the scheme of things. If I open the 1st. form in edit view and
use the button to navigate to the 2nd. form all is okay. But if I am entering
a New Record, the 2nd form does not populate the Table. How do I adjust my
coding for this. I am kinda lost here. Code for the button follows:

Private Sub Command235_Click()
On Error GoTo Err_Command235_Click

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "Logistics & Routing"

stLinkCriteria = "[CustOrderNum]=" & Me![BillOfLadingTxt]
DoCmd.OpenForm stDocName, , , stLinkCriteria

Exit_Command235_Click:
Exit Sub

Err_Command235_Click:
MsgBox Err.Description
Resume Exit_Command235_Click

End Sub

Thanks


--
RuralGuy (RG for short) aka Allan Bunch MS Access MVP - acXP WinXP Pro
Please post back to this forum so all may benefit.

Message posted via http://www.accessmonster.com

 




Thread Tools
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

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 01:46 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.