Moving from one Form to the Next. please help

tonylpcs

Registered User.
Local time
Today, 01:03
Joined
Feb 15, 2011
Messages
27
Hi Everyone,

can someone please help me?
(when I say help, please simple instructions to follow, not gobble de goop!)

I have a simple access database used to hold information so I can then do a mail merge letter with the relevent info.

the problem i have is that i have 2 form pages i need to fill in.

one is called "maindetails" the other "salesdetails"
i have a button which i use to click on and change from one form to another but it will not open on the clients details i was on on the other form.

for instance i might be looking at record number 25 but when i click on the button it take me to the new form closes and saves the old form but wont open the new form to the current client record i.e. number 25, it goes to record 1.

how can i solve this?

below is the macro i use at the moment, if anyonewould mind adding to it with the solution i would be most greratful.

Thanks

Tony

Code:
Private Sub Command286_Click()
On Error GoTo Err_Command286_Click

   If Me.Dirty Then Me.Dirty = False
    DoCmd.Save
    
    If Me.Dirty Then Me.Dirty = False
    DoCmd.Close
    
    Dim stDocName As String
    Dim stLinkCriteria As String
    stDocName = "Abbotts Input 1"
    DoCmd.OpenForm stDocName, , , stLinkCriteria
Exit_Command286_Click:
    Exit Sub
Err_Command286_Click:
    MsgBox Err.Description
    Resume Exit_Command286_Click
    
End Sub
 
Hi Everyone,

can someone please help me?
(when I say help, please simple instructions to follow, not gobble de goop!)

I have a simple access database used to hold information so I can then do a mail merge letter with the relevent info.

the problem i have is that i have 2 form pages i need to fill in.

one is called "maindetails" the other "salesdetails"
i have a button which i use to click on and change from one form to another but it will not open on the clients details i was on on the other form.

for instance i might be looking at record number 25 but when i click on the button it take me to the new form closes and saves the old form but wont open the new form to the current client record i.e. number 25, it goes to record 1.

how can i solve this?

below is the macro i use at the moment, if anyonewould mind adding to it with the solution i would be most greratful.

Thanks

Tony

Code:
Private Sub Command286_Click()
On Error GoTo Err_Command286_Click

   If Me.Dirty Then Me.Dirty = False
    DoCmd.Save
    
    If Me.Dirty Then Me.Dirty = False
    DoCmd.Close
    
    Dim stDocName As String
    Dim stLinkCriteria As String
    stDocName = "Abbotts Input 1"
    DoCmd.OpenForm stDocName, , , stLinkCriteria
Exit_Command286_Click:
    Exit Sub
Err_Command286_Click:
    MsgBox Err.Description
    Resume Exit_Command286_Click
    
End Sub

It's hard to add code to what you have since I don't have specifics, but whatever text box contains the customer number (or whatever your primary key field is), that data has to be passed from the text box in the first form to a text box in the second form, and that form has to have its records filtered based on that text box.

This thread might be of some use to you.

http://www.access-programmers.co.uk/forums/showthread.php?t=17907
 
Code:
   If Me.Dirty Then Me.Dirty = False
    DoCmd.Save
    
    If Me.Dirty Then Me.Dirty = False
    DoCmd.Close
    
    Dim stDocName As String
    Dim stLinkCriteria As String
    stDocName = "Abbotts Input 1"
    DoCmd.OpenForm stDocName, , , stLinkCriteria

1. You did not define the content of the 'stLinkCriteria' variable.

2. you should declare it before closing the first form (DoCmd.Close).
 
Hi thank you for that help,

could someone help me with the code i need if you dont mind,

I been playing around with it for 2 days and cant get it to work.?

please help me!

Tony
 
Can you send the file or creare a sample of it and send it.
But I'll be able to try it out not before Monday.
 

Users who are viewing this thread

Back
Top Bottom