A problem worth pondering.
I have two forms
frmAspirants which takes in details of aspirants in an election
frmChequeDetails which takes the details of the cheques paid by the aspirants.
In the frmAspirants there is an option group (optPayMode) where the user selects whether its paid in cash or cheque.
When the user enters all the details and the option is check then there is a command that opens frmChequeDetails using the following code
Private Sub cmdCheque_Click()
On Error GoTo Err_cmdCheque_Click
DoCmd.OpenForm "ChequeDetails", , , , acAdd, , Me.IDNO
Exit_cmdCheque_Click:
Exit Sub
Err_cmdCheque_Click:
MsgBox Err.Description
Resume Exit_cmdCheque_Click
End Sub
Then on the OnLoad event of frmChequeDetails there is this code
Private Sub Form_Load()
Dim db As DAO.Database
Dim rst As DAO.Recordset
Set db = CurrentDb()
Set rst = db.OpenRecordset("SELECT * FROM ConstituencyAspirants WHERE [IDNO]=" & Me.OpenArgs)
If Nz(rst.RecordCount, 0) <> 0 Then
With rst
Me.IDNO = .Fields("IDNO") 'i.e. your control name would be something
'like Me.CustomerName
Me.FullName = .Fields("FullName")
Me.VoterRegistrationNo = .Fields("VoterRegistrationNo")
Me.Amount = .Fields("Amount")
End With
Else
MsgBox "This Aspirant Doesn't really exist"
End If
rst.Close
Set rst = Nothing
db.Close
Set db = Nothing
End Sub
The problems is since the data is yet to be saved am getting the message.
Also an error about the syntax in the Set rst Line.
Anyone with an idea how you can open a form with OpenArgs before the other data is saved
all help appreciated
I have two forms
frmAspirants which takes in details of aspirants in an election
frmChequeDetails which takes the details of the cheques paid by the aspirants.
In the frmAspirants there is an option group (optPayMode) where the user selects whether its paid in cash or cheque.
When the user enters all the details and the option is check then there is a command that opens frmChequeDetails using the following code
Private Sub cmdCheque_Click()
On Error GoTo Err_cmdCheque_Click
DoCmd.OpenForm "ChequeDetails", , , , acAdd, , Me.IDNO
Exit_cmdCheque_Click:
Exit Sub
Err_cmdCheque_Click:
MsgBox Err.Description
Resume Exit_cmdCheque_Click
End Sub
Then on the OnLoad event of frmChequeDetails there is this code
Private Sub Form_Load()
Dim db As DAO.Database
Dim rst As DAO.Recordset
Set db = CurrentDb()
Set rst = db.OpenRecordset("SELECT * FROM ConstituencyAspirants WHERE [IDNO]=" & Me.OpenArgs)
If Nz(rst.RecordCount, 0) <> 0 Then
With rst
Me.IDNO = .Fields("IDNO") 'i.e. your control name would be something
'like Me.CustomerName
Me.FullName = .Fields("FullName")
Me.VoterRegistrationNo = .Fields("VoterRegistrationNo")
Me.Amount = .Fields("Amount")
End With
Else
MsgBox "This Aspirant Doesn't really exist"
End If
rst.Close
Set rst = Nothing
db.Close
Set db = Nothing
End Sub
The problems is since the data is yet to be saved am getting the message.
Also an error about the syntax in the Set rst Line.
Anyone with an idea how you can open a form with OpenArgs before the other data is saved
all help appreciated