Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Anyone has done something like this?

Status
Not open for further replies.

HappyRed

Programmer
Mar 22, 2005
9
US
I will place this question both in the Forms and the Table Forum because I am not sure where should it be.

I am trying to do a payment calendar, sort of a What if scenario.

My form has 3 fields. Customer ID, Amount to pay and Number of payments.

Based on this information I have to create a bunch of fields, each one which is a payment date and amount.

The Form has to be unbound at the beginning. After I capture the data, I calculate the payments programatically, which I can.

I also opened a recordset that has the data.

What I am missing is how to connect these data back to the form.

This is my code

Set cnn1 = New ADODB.Connection

With cnn1
.Provider = "Microsoft.Jet.OLEDB.4.0"
.ConnectionString = CurrentProject.Path & "\credito_App.mdb"
.Open
End With

Set rsCust = New ADODB.Recordset
rsCust.CursorType = adOpenKeyset
rsCust.LockType = adLockOptimistic

rsCust.Open "Calendar", cnn1

With rsClientes
' With frm1
.AddNew

' Save Data to DB

.Fields("IDnumber").Value = Me.FindCust
.Fields("Payments").Value = Me.Payments
.Fields("Total").Value = Me.Total

m = Me.Payments
For j = 1 To m
nextrec = recname + Trim(Str(j))
MsgBox ("I will save" + " " + nextrec)

.Fields(nextrec).Value = Amount

Next j
.Requery

End With

When I look into the Database the new record is not there and I don't know how to connect this new record to the Form since the Form is unbound. DO i Need to have two identical Forms one bound and the other unbound and here switch to the other form?

I will greatly appreciate the input.

PS: I also want to be able to press a "F9" function key an pop up a form. Is there a way to do this?
 
When I look into the Database the new record is not there
Replace this:
.Requery
By this:
.Update

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
In the posting (snippet), I do not see the declaration for csclients. On the apparent use of ADO recordsets, the .AddNew (re rsClients) will / should cause an error. If, as implied by the lack of mention of an error, it is a DAO type recordset it is necessary, but raises the question of why you wold choose to intermingle thesse (seperate recordset types)? Finally, you could use the recordset as a continuious form sub-form on the unbound form.




MichaelRed


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top