andymartin3186
Member
- Local time
- Today, 12:13
- Joined
- Dec 10, 2024
- Messages
- 40
Hi,
I'm trying to open a form from my main menu to a new record and pre insert some fields.
The form opens at a new record however I'm not sure why nothing happens from there on, it opens with everything blank including the autonumber, is there something I need to add to create the record?
Dim ManufacturerTxt As String
Dim ModelTxt As String
Dim SerialTxt As String
Dim intStatus As Integer
Dim Question As Integer
ManufacturerTxt = "TBC"
ModelTxt = "TBC"
SerialTxt = "TBC"
DescriptionTxt = "TBC"
intStatus = 9
DoCmd.OpenForm "Job Form"
DoCmd.GoToRecord acDataForm, "Job Form", acNewRec
strsql = "INSERT INTO Job (Manufacturer, Model, Serial, Description, StatusID) Values ( '" & ManufacturerTxt & "', '" & ModelTxt & "', '" & SerialTxt & "','" & DescriptionTxt & "' , " & intStatus & ")"
Debug.Print strsql
CurrentDb.Execute strsql
I'm trying to open a form from my main menu to a new record and pre insert some fields.
The form opens at a new record however I'm not sure why nothing happens from there on, it opens with everything blank including the autonumber, is there something I need to add to create the record?
Dim ManufacturerTxt As String
Dim ModelTxt As String
Dim SerialTxt As String
Dim intStatus As Integer
Dim Question As Integer
ManufacturerTxt = "TBC"
ModelTxt = "TBC"
SerialTxt = "TBC"
DescriptionTxt = "TBC"
intStatus = 9
DoCmd.OpenForm "Job Form"
DoCmd.GoToRecord acDataForm, "Job Form", acNewRec
strsql = "INSERT INTO Job (Manufacturer, Model, Serial, Description, StatusID) Values ( '" & ManufacturerTxt & "', '" & ModelTxt & "', '" & SerialTxt & "','" & DescriptionTxt & "' , " & intStatus & ")"
Debug.Print strsql
CurrentDb.Execute strsql