Build a new record from a form entry

Les Blair

Registered User.
Local time
Yesterday, 22:54
Joined
Sep 10, 2007
Messages
49
I have a tbl that has 2 fields on it Ctl nbr(autonum) and Ctl Name(txt) when the user enters a new Ctl Name the tbl creates a new Ctl Nbr. then the user press a cmd button to go to the next form. I have to open a blank form except for the Ctl nbr and the Ctl Name which is from the first form. How do I pass that info and open a new form. I have tried many way none works I am at a lost. Can someone help me. :confused:
 
Once I save the record how do I know that I will get that record when I open the form?:confused:
 
The lines below is where I am having problems.
I am on the form called 'frmNewCaseTrack' I have entered the 'Case Name' and generated the 'Case Track Nbr' now I need to go the the form 'frmSBDProspect' I want to build a record on the tblProspects using the Case Track Nbr and the Case Name I just finished entering on the 'frmNewCaseTrack'. Where have I gone wrong nothing is working and I am at a lost. I am a MainFrame programmer trying to code this. I do understand a little SQL and VB but need a lot of help.

'Save the current information'
DoCmd.RunCommand acCmdSaveRecord
'Set the string stDocName to the form I need to go to.
stDocName = "frmSBDProspects"
'Set the Interger intNum to the case track Nbr I need to use sb same as the new number I entered.
intNum = Forms.frmNewCaseTrack.tblCaseTrack.Forms.[Case Track Nbr]
'Set the string to the field & intNum
stLinkCriteria = ([Case Track Nbr] = " & intNum & ")
'Do the Openform withe the Doc Name and the Criteria
DoCmd.OpenForm stDocName, , , stLinkCriteria

It opens the doc but does not show the new Case Track Nbr or the Case Name. When I look at the tblProspects it does not show the new record either. What do I need to do to fix this and could you give me some help on the code. I am sure that it is a very simple fix and I will be kicking myself for not seeing it. Thank you in advance.:confused:
 
intNum = Forms.frmNewCaseTrack.tblCaseTrack.Forms.[Case Track Nbr]
intNum = Me! [Case Track Nbr]
 
Rich,

I could not get that to work. So I now am running a query to append the new record to the table:

Dim stDocName As String
Dim stLinkCriteria As String
Dim intNum As Integer

'Save the current record
DoCmd.RunCommand acCmdSaveRecord
'Run a query to add the new record to the table (tblProspects)
DoCmd.OpenQuery "InsertNewSBDProspects", acViewNormal, acAdd
'Set the doc name to the form
stDocName = "frmSBDProspects"
'set an integer to the case track number that I just entered.
intNum = Forms.frmNewCaseTrack.[Case Track Nbr]
intNum = Me![Case Track Nbr]
'Set the link criteria to the requested number
stLinkCriteria = ([Case Track Nbr] = " & intNum & ")
'Open the form that has the requested number.
DoCmd.OpenForm stDocName, , , stLinkCriteria

I get the new case track number added to the table but when I try to open the form to look at the new case I get an error '6' overflow.:o
 

Users who are viewing this thread

Back
Top Bottom